Skip to content

Commit

Permalink
Use the READ with the username instead of the GUID in the User CRUD
Browse files Browse the repository at this point in the history
  • Loading branch information
oforero committed Mar 22, 2023
1 parent d273398 commit 10c8756
Show file tree
Hide file tree
Showing 23 changed files with 323 additions and 683 deletions.
19 changes: 0 additions & 19 deletions docs/resources/kopicloud_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,20 @@ Element to create, update, delete Users from Active Directory
### Optional

- `change_password_next_logon` (Boolean)
- `city` (String)
- `company` (String)
- `country` (String)
- `department` (String)
- `description` (String)
- `display_name` (String)
- `email_address` (String)
- `first_name` (String)
- `home_folder_directory` (String)
- `home_folder_drive` (String)
- `home_folder_path` (String)
- `home_phone` (String)
- `initials` (String)
- `job_title` (String)
- `last_name` (String)
- `manager` (String)
- `mobile_phone` (String)
- `office` (String)
- `office_phone` (String)
- `ou_path` (String)
- `password_never_expires` (Boolean)
- `po_box` (String)
- `profile_logon_script` (String)
- `profile_path` (String)
- `rds_allow_logon` (Boolean)
- `rds_connect_drive` (Boolean)
- `rds_home_folder_drive` (String)
- `rds_home_folder_path` (String)
- `rds_profile_path` (String)
- `show_fields` (String)
- `state` (String)
- `street` (String)
- `zip_code` (String)

### Read-Only

Expand Down
5 changes: 3 additions & 2 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,12 @@ provider "kopicloud" {
# }

resource "kopicloud_user" "test" {
username = "oforero13"
username = "oforero14"
password = var.oforero11_password
first_name = "Oscar"
last_name = "Forero"
show_fields = "Username,FirstName,LastName"
initials = "OMFC"
company = "Kopicloud Inc."
}

output "user" {
Expand Down
15 changes: 8 additions & 7 deletions generator-inputs/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,16 @@
},
"read": {
"api_function": {
"name": "GetApiADUserGuidDetailsWithResponse",
"arguments": [],
"name": "GetApiADUserUsernameDetailsWithResponse",
"arguments": [
{
"name": "username",
"type": "string"
}
],
"params": {
"name": "GetApiADUserGuidDetailsParams",
"name": "GetApiADUserUsernameDetailsParams",
"fields": [
{
"api_name": "UserGuid",
"type": "string"
},
{
"api_name": "ShowFields",
"name": "show_fields",
Expand Down
4 changes: 2 additions & 2 deletions provider/kopicloud.computer-cleanup-crud.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func resourceComputerCleanUp() *schema.Resource {

func resourceComputerCleanUpCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
// Warning or errors can be collected in a slice type
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerCleanUpRead"))
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerCleanUpCreate"))
var diags diag.Diagnostics
c := m.(*ApiClient)
tflog.Debug(ctx, "Terraform data", map[string]interface{}{
Expand Down Expand Up @@ -267,7 +267,7 @@ func resourceComputerCleanUpRead(ctx context.Context, d *schema.ResourceData, m

func resourceComputerCleanUpDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
// Warning or errors can be collected in a slice type
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerCleanUpRead"))
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerCleanUpDelete"))
var diags diag.Diagnostics
c := m.(*ApiClient)
tflog.Debug(ctx, "Terraform data", map[string]interface{}{
Expand Down
4 changes: 2 additions & 2 deletions provider/kopicloud.computer-crud.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func resourceComputer() *schema.Resource {

func resourceComputerCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
// Warning or errors can be collected in a slice type
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerRead"))
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerCreate"))
var diags diag.Diagnostics
c := m.(*ApiClient)
tflog.Debug(ctx, "Terraform data", map[string]interface{}{
Expand Down Expand Up @@ -242,7 +242,7 @@ func resourceComputerRead(ctx context.Context, d *schema.ResourceData, m interfa

func resourceComputerDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
// Warning or errors can be collected in a slice type
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerRead"))
tflog.Debug(ctx, fmt.Sprintf("Beginning resourceComputerDelete"))
var diags diag.Diagnostics
c := m.(*ApiClient)
tflog.Debug(ctx, "Terraform data", map[string]interface{}{
Expand Down
Loading

0 comments on commit 10c8756

Please sign in to comment.