diff --git a/generator-inputs/organizational_unit.json b/generator-inputs/organizational_unit.json index 86e0597..fbe731e 100644 --- a/generator-inputs/organizational_unit.json +++ b/generator-inputs/organizational_unit.json @@ -90,7 +90,7 @@ }, { "name": "ou_path", - "result_field": "Path", + "result_field": "Result.Path", "type": "schema.TypeString", "computed": true }, diff --git a/generator-inputs/user.json b/generator-inputs/user.json index ea92ec6..aacd57c 100644 --- a/generator-inputs/user.json +++ b/generator-inputs/user.json @@ -107,199 +107,199 @@ }, { "name": "first_name", - "result_field": "FirstName", + "result_field": "Result.FirstName", "type": "schema.TypeString", "optional": true }, { "name": "initials", - "result_field": "Initials", + "result_field": "Result.Initials", "type": "schema.TypeString", "optional": true }, { "name": "last_name", - "result_field": "LastName", + "result_field": "Result.LastName", "type": "schema.TypeString", "optional": true }, { "name": "display_name", - "result_field": "DisplayName", + "result_field": "Result.DisplayName", "type": "schema.TypeString", "optional": true }, { "name": "description", - "result_field": "Description", + "result_field": "Result.Description", "type": "schema.TypeString", "optional": true }, { "name": "email_address", - "result_field": "EmailAddress", + "result_field": "Result.EmailAddress", "type": "schema.TypeString", "optional": true }, { "name": "department", - "result_field": "Department", + "result_field": "Result.Department", "type": "schema.TypeString", "optional": true }, { "name": "office", - "result_field": "Office", + "result_field": "Result.Office", "type": "schema.TypeString", "optional": true }, { "name": "company", - "result_field": "Company", + "result_field": "Result.Company", "type": "schema.TypeString", "optional": true }, { "name": "change_password_next_logon", - "result_field": "ChangePasswordNextLogon", + "result_field": "Result.ChangePasswordNextLogon", "type": "schema.TypeBool", "optional": true }, { "name": "password_never_expires", - "result_field": "PasswordNeverExpired", + "result_field": "Result.PasswordNeverExpired", "type": "schema.TypeBool", "optional": true }, { "name": "ou_path", - "result_field": "OuPath", + "result_field": "Result.OuPath", "type": "schema.TypeString", "optional": true }, { "name": "job_title", - "result_field": "JobTitle", + "result_field": "Result.JobTitle", "type": "schema.TypeString", "optional": true }, { "name": "manager", - "result_field": "Manager", + "result_field": "Result.Manager", "type": "schema.TypeString", "optional": true }, { "name": "street", - "result_field": "StreetAddress", + "result_field": "Result.StreetAddress", "type": "schema.TypeString", "optional": true }, { "name": "po_box", - "result_field": "StreetPoBox", + "result_field": "Result.StreetPoBox", "type": "schema.TypeString", "optional": true }, { "name": "city", - "result_field": "City", + "result_field": "Result.City", "type": "schema.TypeString", "optional": true }, { "name": "state", - "result_field": "State", + "result_field": "Result.State", "type": "schema.TypeString", "optional": true }, { "name": "zip_code", - "result_field": "PostalCode", + "result_field": "Result.PostalCode", "type": "schema.TypeString", "optional": true }, { "name": "country", - "result_field": "Country", + "result_field": "Result.Country", "type": "schema.TypeString", "optional": true }, { "name": "office_phone", - "result_field": "OfficePhone", + "result_field": "Result.OfficePhone", "type": "schema.TypeString", "optional": true }, { "name": "home_phone", - "result_field": "HomePhone", + "result_field": "Result.HomePhone", "type": "schema.TypeString", "optional": true }, { "name": "mobile_phone", - "result_field": "MobilePhone", + "result_field": "Result.MobilePhone", "type": "schema.TypeString", "optional": true }, { "name": "profile_path", - "result_field": "ProfilePath", + "result_field": "Result.ProfilePath", "type": "schema.TypeString", "optional": true }, { "name": "profile_logon_script", - "result_field": "ProfileLogonScript", + "result_field": "Result.ProfileLogonScript", "type": "schema.TypeString", "optional": true }, { "name": "home_folder_path", - "result_field": "HomeFolderPath", + "result_field": "Result.HomeFolderPath", "type": "schema.TypeString", "optional": true }, { "name": "home_folder_drive", - "result_field": "HomeFolderDrive", + "result_field": "Result.HomeFolderDrive", "type": "schema.TypeString", "optional": true }, { "name": "home_folder_directory", - "result_field": "HomeFolderDirectory", + "result_field": "Result.HomeFolderDirectory", "type": "schema.TypeString", "optional": true }, { "name": "rds_profile_path", - "result_field": "RdsProfilePath", + "result_field": "Result.RdsProfilePath", "type": "schema.TypeString", "optional": true }, { "name": "rds_home_folder_path", - "result_field": "RdsHomeFolderPath", + "result_field": "Result.RdsHomeFolderPath", "type": "schema.TypeString", "optional": true }, { "name": "rds_home_folder_drive", - "result_field": "RdsHomeFolderDrive", + "result_field": "Result.RdsHomeFolderDrive", "type": "schema.TypeString", "optional": true }, { "name": "rds_connect_drive", - "result_field": "RdsConnectDrive", + "result_field": "Result.RdsConnectDrive", "type": "schema.TypeBool", "optional": true }, { "name": "rds_allow_logon", - "result_field": "RdsAllowLogon", + "result_field": "Result.RdsAllowLogon", "type": "schema.TypeBool", "optional": true }, diff --git a/generator-inputs/user_disable.json b/generator-inputs/user_disable.json index 8a276eb..c3a7357 100644 --- a/generator-inputs/user_disable.json +++ b/generator-inputs/user_disable.json @@ -15,6 +15,12 @@ "type": "schema.TypeString", "required": true }, + { + "name": "result", + "type": "schema.TypeString", + "result_field": "Output", + "computed": true + }, { "name": "show_fields", "type": "schema.TypeString", @@ -22,12 +28,7 @@ } ] }, - "result_schemas": { - "result": { - "schema_function": "schemaOfUser", - "schema_function_arguments": "(``)" - } - }, + "result_schemas": {}, "element_name": "UserDisableAccount", "create": { @@ -56,7 +57,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -84,7 +84,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -112,7 +111,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } } diff --git a/generator-inputs/user_enable.json b/generator-inputs/user_enable.json index 8d793ac..0b9d9c5 100644 --- a/generator-inputs/user_enable.json +++ b/generator-inputs/user_enable.json @@ -15,6 +15,12 @@ "type": "schema.TypeString", "required": true }, + { + "name": "result", + "type": "schema.TypeString", + "result_field": "Output", + "computed": true + }, { "name": "show_fields", "type": "schema.TypeString", @@ -22,12 +28,7 @@ } ] }, - "result_schemas": { - "result": { - "schema_function": "schemaOfUser", - "schema_function_arguments": "(``)" - } - }, + "result_schemas": {}, "element_name": "UserEnableAccount", "create": { @@ -56,7 +57,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -84,7 +84,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -112,7 +111,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } } diff --git a/generator-inputs/user_password_reset.json b/generator-inputs/user_password_reset.json index 99698cd..62c94c6 100644 --- a/generator-inputs/user_password_reset.json +++ b/generator-inputs/user_password_reset.json @@ -26,6 +26,12 @@ "type": "schema.TypeBool", "optional": true }, + { + "name": "result", + "type": "schema.TypeString", + "result_field": "Output", + "computed": true + }, { "name": "show_fields", "type": "schema.TypeString", @@ -33,12 +39,7 @@ } ] }, - "result_schemas": { - "result": { - "schema_function": "schemaOfUser", - "schema_function_arguments": "(``)" - } - }, + "result_schemas": {}, "element_name": "UserPasswordReset", "create": { @@ -77,7 +78,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -105,7 +105,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -133,7 +132,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } } diff --git a/generator-inputs/user_rename.json b/generator-inputs/user_rename.json index cee3203..30e1fa7 100644 --- a/generator-inputs/user_rename.json +++ b/generator-inputs/user_rename.json @@ -25,6 +25,12 @@ "type": "schema.TypeBool", "optional": true }, + { + "name": "result", + "type": "schema.TypeString", + "result_field": "Output", + "computed": true + }, { "name": "show_fields", "type": "schema.TypeString", @@ -33,7 +39,7 @@ ] }, "result_schemas": { - "result": { + "user": { "schema_function": "schemaOfUser", "schema_function_arguments": "(``)" } @@ -70,7 +76,7 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", + "terraform_field": "user", "api_to_terraform_id": "getId_for_User" } }, @@ -98,7 +104,7 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", + "terraform_field": "user", "api_to_terraform_id": "getId_for_User" } }, @@ -126,7 +132,7 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", + "terraform_field": "user", "api_to_terraform_id": "getId_for_User" } } diff --git a/generator-inputs/user_unlock.json b/generator-inputs/user_unlock.json index b25a125..be8572d 100644 --- a/generator-inputs/user_unlock.json +++ b/generator-inputs/user_unlock.json @@ -15,6 +15,12 @@ "type": "schema.TypeString", "required": true }, + { + "name": "result", + "type": "schema.TypeString", + "result_field": "Output", + "computed": true + }, { "name": "show_fields", "type": "schema.TypeString", @@ -56,7 +62,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -84,7 +89,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } }, @@ -112,7 +116,6 @@ "result_field": "Result", "api_to_terraform": "UserToTerraform", "result_wrapper": "wrapInArray", - "terraform_field": "result", "api_to_terraform_id": "getId_for_User" } } diff --git a/provider/kopicloud.converters.gen.go b/provider/kopicloud.converters.gen.go index 371276c..29ceca5 100644 --- a/provider/kopicloud.converters.gen.go +++ b/provider/kopicloud.converters.gen.go @@ -37,45 +37,45 @@ func isNotEmpty(f interface{}) bool { func GroupToTerraform(obj *api.Group) map[string]interface{} { result := make(map[string]interface{}) - if obj.Guid != nil && isNotEmpty(obj.Guid) { + if obj.Description != nil && isNotEmpty(obj.Description) { - result["guid"] = UuidToTerraform(obj.Guid) + result["description"] = obj.Description } - if obj.Name != nil && isNotEmpty(obj.Name) { + if obj.Email != nil && isNotEmpty(obj.Email) { - result["name"] = obj.Name + result["email"] = obj.Email } - if obj.Scope != nil && isNotEmpty(obj.Scope) { + if obj.OuPath != nil && isNotEmpty(obj.OuPath) { - result["scope"] = obj.Scope + result["ou_path"] = obj.OuPath } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["description"] = obj.Description + result["type"] = obj.Type } - if obj.Email != nil && isNotEmpty(obj.Email) { + if obj.Guid != nil && isNotEmpty(obj.Guid) { - result["email"] = obj.Email + result["guid"] = UuidToTerraform(obj.Guid) } - if obj.OuPath != nil && isNotEmpty(obj.OuPath) { + if obj.Name != nil && isNotEmpty(obj.Name) { - result["ou_path"] = obj.OuPath + result["name"] = obj.Name } - if obj.Type != nil && isNotEmpty(obj.Type) { + if obj.Scope != nil && isNotEmpty(obj.Scope) { - result["type"] = obj.Type + result["scope"] = obj.Scope } @@ -93,427 +93,427 @@ func GroupListToTerraform(list *[]api.Group) []interface{} { return make([]interface{}, 0) } -func ComputerToTerraform(obj *api.Computer) map[string]interface{} { +func UserToTerraform(obj *api.User) map[string]interface{} { result := make(map[string]interface{}) - if obj.Sid != nil && isNotEmpty(obj.Sid) { + if obj.FirstName != nil && isNotEmpty(obj.FirstName) { - result["sid"] = obj.Sid + result["first_name"] = obj.FirstName } - if obj.ComputerName != nil && isNotEmpty(obj.ComputerName) { + if obj.StreetPoBox != nil && isNotEmpty(obj.StreetPoBox) { - result["computer_name"] = obj.ComputerName + result["street_po_box"] = obj.StreetPoBox } - if obj.OperatingSystem != nil && isNotEmpty(obj.OperatingSystem) { + if obj.ProfilePath != nil && isNotEmpty(obj.ProfilePath) { - result["operating_system"] = obj.OperatingSystem + result["profile_path"] = obj.ProfilePath } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.Guid != nil && isNotEmpty(obj.Guid) { - result["description"] = obj.Description + result["guid"] = UuidToTerraform(obj.Guid) } - if obj.DnsName != nil && isNotEmpty(obj.DnsName) { + if obj.PasswordNeverExpired != nil && isNotEmpty(obj.PasswordNeverExpired) { - result["dns_name"] = obj.DnsName + result["password_never_expired"] = obj.PasswordNeverExpired } - if obj.Path != nil && isNotEmpty(obj.Path) { + if obj.JobTitle != nil && isNotEmpty(obj.JobTitle) { - result["path"] = obj.Path + result["job_title"] = obj.JobTitle } - if obj.Created != nil && isNotEmpty(obj.Created) { - - result["created"] = obj.Created - - } + if obj.ProfileLogonScript != nil && isNotEmpty(obj.ProfileLogonScript) { - return result -} + result["profile_logon_script"] = obj.ProfileLogonScript -func ComputerListToTerraform(list *[]api.Computer) []interface{} { - if list != nil { - results := make([]interface{}, len(*list)) - for i, Computer := range *list { - results[i] = ComputerToTerraform(&Computer) - } - return results } - return make([]interface{}, 0) -} -func DnsZoneToTerraform(obj *api.DnsZone) map[string]interface{} { - result := make(map[string]interface{}) - - if obj.DistinguishedName != nil && isNotEmpty(obj.DistinguishedName) { + if obj.SamUsername != nil && isNotEmpty(obj.SamUsername) { - result["distinguished_name"] = obj.DistinguishedName + result["sam_username"] = obj.SamUsername } - if obj.ZoneName != nil && isNotEmpty(obj.ZoneName) { + if obj.OuPath != nil && isNotEmpty(obj.OuPath) { - result["zone_name"] = obj.ZoneName + result["ou_path"] = obj.OuPath } - if obj.ZoneType != nil && isNotEmpty(obj.ZoneType) { + if obj.Manager != nil && isNotEmpty(obj.Manager) { - result["zone_type"] = obj.ZoneType + result["manager"] = obj.Manager } - if obj.Type != nil && isNotEmpty(obj.Type) { - - result["type"] = obj.Type - - } + if obj.City != nil && isNotEmpty(obj.City) { - return result -} + result["city"] = obj.City -func DnsZoneListToTerraform(list *[]api.DnsZone) []interface{} { - if list != nil { - results := make([]interface{}, len(*list)) - for i, DnsZone := range *list { - results[i] = DnsZoneToTerraform(&DnsZone) - } - return results } - return make([]interface{}, 0) -} -func UserToTerraform(obj *api.User) map[string]interface{} { - result := make(map[string]interface{}) - - if obj.Username != nil && isNotEmpty(obj.Username) { + if obj.Department != nil && isNotEmpty(obj.Department) { - result["username"] = obj.Username + result["department"] = obj.Department } - if obj.Office != nil && isNotEmpty(obj.Office) { + if obj.OfficePhone != nil && isNotEmpty(obj.OfficePhone) { - result["office"] = obj.Office + result["office_phone"] = obj.OfficePhone } - if obj.OuPath != nil && isNotEmpty(obj.OuPath) { + if obj.State != nil && isNotEmpty(obj.State) { - result["ou_path"] = obj.OuPath + result["state"] = obj.State } - if obj.RdsHomeFolderPath != nil && isNotEmpty(obj.RdsHomeFolderPath) { + if obj.Initials != nil && isNotEmpty(obj.Initials) { - result["rds_home_folder_path"] = obj.RdsHomeFolderPath + result["initials"] = obj.Initials } - if obj.RdsHomeFolderDrive != nil && isNotEmpty(obj.RdsHomeFolderDrive) { + if obj.HomePhone != nil && isNotEmpty(obj.HomePhone) { - result["rds_home_folder_drive"] = obj.RdsHomeFolderDrive + result["home_phone"] = obj.HomePhone } - if obj.Company != nil && isNotEmpty(obj.Company) { + if obj.MobilePhone != nil && isNotEmpty(obj.MobilePhone) { - result["company"] = obj.Company + result["mobile_phone"] = obj.MobilePhone } - if obj.JobTitle != nil && isNotEmpty(obj.JobTitle) { + if obj.HomeFolderPath != nil && isNotEmpty(obj.HomeFolderPath) { - result["job_title"] = obj.JobTitle + result["home_folder_path"] = obj.HomeFolderPath } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.HomeFolderDrive != nil && isNotEmpty(obj.HomeFolderDrive) { - result["description"] = obj.Description + result["home_folder_drive"] = obj.HomeFolderDrive } - if obj.PostalCode != nil && isNotEmpty(obj.PostalCode) { + if obj.Username != nil && isNotEmpty(obj.Username) { - result["postal_code"] = obj.PostalCode + result["username"] = obj.Username } - if obj.HomePhone != nil && isNotEmpty(obj.HomePhone) { + if obj.Office != nil && isNotEmpty(obj.Office) { - result["home_phone"] = obj.HomePhone + result["office"] = obj.Office } - if obj.ProfileLogonScript != nil && isNotEmpty(obj.ProfileLogonScript) { + if obj.HomeFolderDirectory != nil && isNotEmpty(obj.HomeFolderDirectory) { - result["profile_logon_script"] = obj.ProfileLogonScript + result["home_folder_directory"] = obj.HomeFolderDirectory } - if obj.FirstName != nil && isNotEmpty(obj.FirstName) { + if obj.RdsProfilePath != nil && isNotEmpty(obj.RdsProfilePath) { - result["first_name"] = obj.FirstName + result["rds_profile_path"] = obj.RdsProfilePath } - if obj.LastName != nil && isNotEmpty(obj.LastName) { + if obj.RdsHomeFolderDrive != nil && isNotEmpty(obj.RdsHomeFolderDrive) { - result["last_name"] = obj.LastName + result["rds_home_folder_drive"] = obj.RdsHomeFolderDrive } - if obj.Initials != nil && isNotEmpty(obj.Initials) { + if obj.RdsAllowLogon != nil && isNotEmpty(obj.RdsAllowLogon) { - result["initials"] = obj.Initials + result["rds_allow_logon"] = obj.RdsAllowLogon } - if obj.ProfilePath != nil && isNotEmpty(obj.ProfilePath) { + if obj.Description != nil && isNotEmpty(obj.Description) { - result["profile_path"] = obj.ProfilePath + result["description"] = obj.Description } - if obj.RdsProfilePath != nil && isNotEmpty(obj.RdsProfilePath) { + if obj.EmailAddress != nil && isNotEmpty(obj.EmailAddress) { - result["rds_profile_path"] = obj.RdsProfilePath + result["email_address"] = obj.EmailAddress } - if obj.RdsAllowLogon != nil && isNotEmpty(obj.RdsAllowLogon) { + if obj.ChangePasswordNextLogon != nil && isNotEmpty(obj.ChangePasswordNextLogon) { - result["rds_allow_logon"] = obj.RdsAllowLogon + result["change_password_next_logon"] = obj.ChangePasswordNextLogon } - if obj.Guid != nil && isNotEmpty(obj.Guid) { + if obj.RdsHomeFolderPath != nil && isNotEmpty(obj.RdsHomeFolderPath) { - result["guid"] = UuidToTerraform(obj.Guid) + result["rds_home_folder_path"] = obj.RdsHomeFolderPath } - if obj.Department != nil && isNotEmpty(obj.Department) { + if obj.RdsConnectDrive != nil && isNotEmpty(obj.RdsConnectDrive) { - result["department"] = obj.Department + result["rds_connect_drive"] = obj.RdsConnectDrive } - if obj.City != nil && isNotEmpty(obj.City) { + if obj.LastName != nil && isNotEmpty(obj.LastName) { - result["city"] = obj.City + result["last_name"] = obj.LastName } - if obj.HomeFolderPath != nil && isNotEmpty(obj.HomeFolderPath) { + if obj.Company != nil && isNotEmpty(obj.Company) { - result["home_folder_path"] = obj.HomeFolderPath + result["company"] = obj.Company } - if obj.RdsConnectDrive != nil && isNotEmpty(obj.RdsConnectDrive) { + if obj.StreetAddress != nil && isNotEmpty(obj.StreetAddress) { - result["rds_connect_drive"] = obj.RdsConnectDrive + result["street_address"] = obj.StreetAddress } - if obj.State != nil && isNotEmpty(obj.State) { + if obj.PostalCode != nil && isNotEmpty(obj.PostalCode) { - result["state"] = obj.State + result["postal_code"] = obj.PostalCode } - if obj.MobilePhone != nil && isNotEmpty(obj.MobilePhone) { + if obj.Country != nil && isNotEmpty(obj.Country) { - result["mobile_phone"] = obj.MobilePhone + result["country"] = obj.Country } - if obj.HomeFolderDrive != nil && isNotEmpty(obj.HomeFolderDrive) { + if obj.DisplayName != nil && isNotEmpty(obj.DisplayName) { - result["home_folder_drive"] = obj.HomeFolderDrive + result["display_name"] = obj.DisplayName } - if obj.DisplayName != nil && isNotEmpty(obj.DisplayName) { - - result["display_name"] = obj.DisplayName + return result +} +func UserListToTerraform(list *[]api.User) []interface{} { + if list != nil { + results := make([]interface{}, len(*list)) + for i, User := range *list { + results[i] = UserToTerraform(&User) + } + return results } + return make([]interface{}, 0) +} - if obj.EmailAddress != nil && isNotEmpty(obj.EmailAddress) { +func DnsZoneToTerraform(obj *api.DnsZone) map[string]interface{} { + result := make(map[string]interface{}) - result["email_address"] = obj.EmailAddress + if obj.DistinguishedName != nil && isNotEmpty(obj.DistinguishedName) { + + result["distinguished_name"] = obj.DistinguishedName } - if obj.ChangePasswordNextLogon != nil && isNotEmpty(obj.ChangePasswordNextLogon) { + if obj.ZoneName != nil && isNotEmpty(obj.ZoneName) { - result["change_password_next_logon"] = obj.ChangePasswordNextLogon + result["zone_name"] = obj.ZoneName } - if obj.PasswordNeverExpired != nil && isNotEmpty(obj.PasswordNeverExpired) { + if obj.ZoneType != nil && isNotEmpty(obj.ZoneType) { - result["password_never_expired"] = obj.PasswordNeverExpired + result["zone_type"] = obj.ZoneType } - if obj.StreetAddress != nil && isNotEmpty(obj.StreetAddress) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["street_address"] = obj.StreetAddress + result["type"] = obj.Type } - if obj.Manager != nil && isNotEmpty(obj.Manager) { - - result["manager"] = obj.Manager + return result +} +func DnsZoneListToTerraform(list *[]api.DnsZone) []interface{} { + if list != nil { + results := make([]interface{}, len(*list)) + for i, DnsZone := range *list { + results[i] = DnsZoneToTerraform(&DnsZone) + } + return results } + return make([]interface{}, 0) +} - if obj.StreetPoBox != nil && isNotEmpty(obj.StreetPoBox) { +func OUToTerraform(obj *api.OU) map[string]interface{} { + result := make(map[string]interface{}) - result["street_po_box"] = obj.StreetPoBox + if obj.Description != nil && isNotEmpty(obj.Description) { + + result["description"] = obj.Description } - if obj.HomeFolderDirectory != nil && isNotEmpty(obj.HomeFolderDirectory) { + if obj.Path != nil && isNotEmpty(obj.Path) { - result["home_folder_directory"] = obj.HomeFolderDirectory + result["path"] = obj.Path } - if obj.SamUsername != nil && isNotEmpty(obj.SamUsername) { + if obj.Protected != nil && isNotEmpty(obj.Protected) { - result["sam_username"] = obj.SamUsername + result["protected"] = obj.Protected } - if obj.Country != nil && isNotEmpty(obj.Country) { + if obj.Guid != nil && isNotEmpty(obj.Guid) { - result["country"] = obj.Country + result["guid"] = UuidToTerraform(obj.Guid) } - if obj.OfficePhone != nil && isNotEmpty(obj.OfficePhone) { + if obj.Name != nil && isNotEmpty(obj.Name) { - result["office_phone"] = obj.OfficePhone + result["name"] = obj.Name } return result } -func UserListToTerraform(list *[]api.User) []interface{} { +func OUListToTerraform(list *[]api.OU) []interface{} { if list != nil { results := make([]interface{}, len(*list)) - for i, User := range *list { - results[i] = UserToTerraform(&User) + for i, OU := range *list { + results[i] = OUToTerraform(&OU) } return results } return make([]interface{}, 0) } -func DnsRecordToTerraform(obj *api.DnsRecord) map[string]interface{} { +func ComputerToTerraform(obj *api.Computer) map[string]interface{} { result := make(map[string]interface{}) - if obj.Timestamp != nil && isNotEmpty(obj.Timestamp) { + if obj.DnsName != nil && isNotEmpty(obj.DnsName) { - result["timestamp"] = obj.Timestamp + result["dns_name"] = obj.DnsName } - if obj.Name != nil && isNotEmpty(obj.Name) { + if obj.Path != nil && isNotEmpty(obj.Path) { - result["name"] = obj.Name + result["path"] = obj.Path } - if obj.Type != nil && isNotEmpty(obj.Type) { + if obj.Created != nil && isNotEmpty(obj.Created) { - result["type"] = obj.Type + result["created"] = obj.Created } - if obj.Data != nil && isNotEmpty(obj.Data) { + if obj.Sid != nil && isNotEmpty(obj.Sid) { - result["data"] = obj.Data + result["sid"] = obj.Sid } - if obj.Zone != nil && isNotEmpty(obj.Zone) { + if obj.ComputerName != nil && isNotEmpty(obj.ComputerName) { - result["zone"] = obj.Zone + result["computer_name"] = obj.ComputerName + + } + + if obj.OperatingSystem != nil && isNotEmpty(obj.OperatingSystem) { + + result["operating_system"] = obj.OperatingSystem + + } + + if obj.Description != nil && isNotEmpty(obj.Description) { + + result["description"] = obj.Description } return result } -func DnsRecordListToTerraform(list *[]api.DnsRecord) []interface{} { +func ComputerListToTerraform(list *[]api.Computer) []interface{} { if list != nil { results := make([]interface{}, len(*list)) - for i, DnsRecord := range *list { - results[i] = DnsRecordToTerraform(&DnsRecord) + for i, Computer := range *list { + results[i] = ComputerToTerraform(&Computer) } return results } return make([]interface{}, 0) } -func OUToTerraform(obj *api.OU) map[string]interface{} { +func DnsRecordToTerraform(obj *api.DnsRecord) map[string]interface{} { result := make(map[string]interface{}) - if obj.Protected != nil && isNotEmpty(obj.Protected) { + if obj.Name != nil && isNotEmpty(obj.Name) { - result["protected"] = obj.Protected + result["name"] = obj.Name } - if obj.Guid != nil && isNotEmpty(obj.Guid) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["guid"] = UuidToTerraform(obj.Guid) + result["type"] = obj.Type } - if obj.Name != nil && isNotEmpty(obj.Name) { + if obj.Data != nil && isNotEmpty(obj.Data) { - result["name"] = obj.Name + result["data"] = obj.Data } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.Zone != nil && isNotEmpty(obj.Zone) { - result["description"] = obj.Description + result["zone"] = obj.Zone } - if obj.Path != nil && isNotEmpty(obj.Path) { + if obj.Timestamp != nil && isNotEmpty(obj.Timestamp) { - result["path"] = obj.Path + result["timestamp"] = obj.Timestamp } return result } -func OUListToTerraform(list *[]api.OU) []interface{} { +func DnsRecordListToTerraform(list *[]api.DnsRecord) []interface{} { if list != nil { results := make([]interface{}, len(*list)) - for i, OU := range *list { - results[i] = OUToTerraform(&OU) + for i, DnsRecord := range *list { + results[i] = DnsRecordToTerraform(&DnsRecord) } return results } diff --git a/provider/kopicloud.ou-crud.gen.go b/provider/kopicloud.ou-crud.gen.go index 4fffd4e..39e9edf 100644 --- a/provider/kopicloud.ou-crud.gen.go +++ b/provider/kopicloud.ou-crud.gen.go @@ -173,7 +173,7 @@ func resourceOUCreate(ctx context.Context, d *schema.ResourceData, m interface{} result := wrapInArray(resItems) - if err := d.Set("ou_path", api_result.Path); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.Path); err != nil { return diag.FromErr(err) } @@ -268,7 +268,7 @@ func resourceOURead(ctx context.Context, d *schema.ResourceData, m interface{}) result := wrapInArray(resItems) - if err := d.Set("ou_path", api_result.Path); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.Path); err != nil { return diag.FromErr(err) } @@ -367,7 +367,7 @@ func resourceOUDelete(ctx context.Context, d *schema.ResourceData, m interface{} result := wrapInArray(resItems) - if err := d.Set("ou_path", api_result.Path); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.Path); err != nil { return diag.FromErr(err) } diff --git a/provider/kopicloud.ou-update.gen.go b/provider/kopicloud.ou-update.gen.go index 606fbfb..17c59b9 100644 --- a/provider/kopicloud.ou-update.gen.go +++ b/provider/kopicloud.ou-update.gen.go @@ -107,7 +107,7 @@ func resourceOU_Update_0(ctx context.Context, d *schema.ResourceData, m interfac result := wrapInArray(resItems) - if err := d.Set("ou_path", api_result.Path); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.Path); err != nil { return diag.FromErr(err) } @@ -202,7 +202,7 @@ func resourceOU_Update_1(ctx context.Context, d *schema.ResourceData, m interfac result := wrapInArray(resItems) - if err := d.Set("ou_path", api_result.Path); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.Path); err != nil { return diag.FromErr(err) } diff --git a/provider/kopicloud.schemas.gen.go b/provider/kopicloud.schemas.gen.go index 346dc7a..c9c4d75 100644 --- a/provider/kopicloud.schemas.gen.go +++ b/provider/kopicloud.schemas.gen.go @@ -37,50 +37,68 @@ func schemaMapOfScalarElement(t schema.ValueType, field_name string) map[string] } } -func schemaOfDnsZoneList(scalar_field_name string) *schema.Schema { +func schemaOfComputerList(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("List of %s", "DnsZone"), + Description: fmt.Sprintf("List of %s", "Computer"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsZone(scalar_field_name), + Schema: schemaMapOfComputer(scalar_field_name), }, } } -func schemaOfDnsZone(scalar_field_name string) *schema.Schema { +func schemaOfComputer(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "DnsZone"), + Description: fmt.Sprintf("Single Element List of %s", "Computer"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsZone(scalar_field_name), + Schema: schemaMapOfComputer(scalar_field_name), }, } } -func schemaMapOfDnsZone(scalar_field_name string) map[string]*schema.Schema { +func schemaMapOfComputer(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "type": { + "sid": { Type: schema.TypeString, Computed: true, Description: "", }, - "distinguished_name": { + "computer_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "zone_name": { + "operating_system": { Type: schema.TypeString, Computed: true, Description: "", }, - "zone_type": { + "description": { + Type: schema.TypeString, + Computed: true, + Description: "", + }, + + "dns_name": { + Type: schema.TypeString, + Computed: true, + Description: "", + }, + + "path": { + Type: schema.TypeString, + Computed: true, + Description: "", + }, + + "created": { Type: schema.TypeString, Computed: true, Description: "", @@ -113,31 +131,31 @@ func schemaOfOU(scalar_field_name string) *schema.Schema { func schemaMapOfOU(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "protected": { - Type: schema.TypeBool, + "name": { + Type: schema.TypeString, Computed: true, Description: "", }, - "guid": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "name": { + "path": { Type: schema.TypeString, Computed: true, Description: "", }, - "description": { - Type: schema.TypeString, + "protected": { + Type: schema.TypeBool, Computed: true, Description: "", }, - "path": { + "guid": { Type: schema.TypeString, Computed: true, Description: "", @@ -145,437 +163,419 @@ func schemaMapOfOU(scalar_field_name string) map[string]*schema.Schema { } } -func schemaOfDnsRecordList(scalar_field_name string) *schema.Schema { +func schemaOfUserList(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("List of %s", "DnsRecord"), + Description: fmt.Sprintf("List of %s", "User"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsRecord(scalar_field_name), + Schema: schemaMapOfUser(scalar_field_name), }, } } -func schemaOfDnsRecord(scalar_field_name string) *schema.Schema { +func schemaOfUser(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "DnsRecord"), + Description: fmt.Sprintf("Single Element List of %s", "User"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsRecord(scalar_field_name), + Schema: schemaMapOfUser(scalar_field_name), }, } } -func schemaMapOfDnsRecord(scalar_field_name string) map[string]*schema.Schema { +func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "type": { + "rds_profile_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "data": { + "display_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "zone": { + "email_address": { Type: schema.TypeString, Computed: true, Description: "", }, - "timestamp": { + "country": { Type: schema.TypeString, Computed: true, Description: "", }, - "name": { + "home_folder_drive": { Type: schema.TypeString, Computed: true, Description: "", }, - } -} -func schemaOfGroupList(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("List of %s", "Group"), - Elem: &schema.Resource{ - Schema: schemaMapOfGroup(scalar_field_name), - }, - } -} - -func schemaOfGroup(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "Group"), - Elem: &schema.Resource{ - Schema: schemaMapOfGroup(scalar_field_name), - }, - } -} - -func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { - return map[string]*schema.Schema{ - - "email": { + "manager": { Type: schema.TypeString, Computed: true, Description: "", }, - "ou_path": { + "profile_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "type": { + "profile_logon_script": { Type: schema.TypeString, Computed: true, Description: "", }, - "guid": { + "username": { Type: schema.TypeString, Computed: true, Description: "", }, - "name": { + "company": { Type: schema.TypeString, Computed: true, Description: "", }, - "scope": { + "initials": { Type: schema.TypeString, Computed: true, Description: "", }, - "description": { - Type: schema.TypeString, + "change_password_next_logon": { + Type: schema.TypeBool, Computed: true, Description: "", }, - } -} -func schemaOfComputerList(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("List of %s", "Computer"), - Elem: &schema.Resource{ - Schema: schemaMapOfComputer(scalar_field_name), - }, - } -} - -func schemaOfComputer(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "Computer"), - Elem: &schema.Resource{ - Schema: schemaMapOfComputer(scalar_field_name), - }, - } -} - -func schemaMapOfComputer(scalar_field_name string) map[string]*schema.Schema { - return map[string]*schema.Schema{ - - "computer_name": { + "guid": { Type: schema.TypeString, Computed: true, Description: "", }, - "operating_system": { + "job_title": { Type: schema.TypeString, Computed: true, Description: "", }, - "description": { + "street_po_box": { Type: schema.TypeString, Computed: true, Description: "", }, - "dns_name": { + "home_folder_directory": { Type: schema.TypeString, Computed: true, Description: "", }, - "path": { + "home_phone": { Type: schema.TypeString, Computed: true, Description: "", }, - "created": { + "mobile_phone": { Type: schema.TypeString, Computed: true, Description: "", }, - "sid": { + "rds_home_folder_path": { Type: schema.TypeString, Computed: true, Description: "", }, - } -} - -func schemaOfUserList(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("List of %s", "User"), - Elem: &schema.Resource{ - Schema: schemaMapOfUser(scalar_field_name), - }, - } -} - -func schemaOfUser(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "User"), - Elem: &schema.Resource{ - Schema: schemaMapOfUser(scalar_field_name), - }, - } -} -func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { - return map[string]*schema.Schema{ - - "display_name": { + "rds_home_folder_drive": { Type: schema.TypeString, Computed: true, Description: "", }, - "email_address": { + "first_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "initials": { + "department": { Type: schema.TypeString, Computed: true, Description: "", }, - "change_password_next_logon": { + "password_never_expired": { Type: schema.TypeBool, Computed: true, Description: "", }, - "street_po_box": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "last_name": { + "city": { Type: schema.TypeString, Computed: true, Description: "", }, - "state": { + "office": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_phone": { + "office_phone": { Type: schema.TypeString, Computed: true, Description: "", }, - "profile_logon_script": { + "home_folder_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_folder_path": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_home_folder_drive": { + "sam_username": { Type: schema.TypeString, Computed: true, Description: "", }, - "guid": { + "ou_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "department": { - Type: schema.TypeString, + "rds_connect_drive": { + Type: schema.TypeBool, Computed: true, Description: "", }, - "sam_username": { + "state": { Type: schema.TypeString, Computed: true, Description: "", }, - "ou_path": { + "postal_code": { Type: schema.TypeString, Computed: true, Description: "", }, - "password_never_expired": { + "rds_allow_logon": { Type: schema.TypeBool, Computed: true, Description: "", }, - "home_folder_directory": { + "last_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_profile_path": { + "street_address": { Type: schema.TypeString, Computed: true, Description: "", }, + } +} - "street_address": { - Type: schema.TypeString, - Computed: true, - Description: "", +func schemaOfDnsRecordList(scalar_field_name string) *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: fmt.Sprintf("List of %s", "DnsRecord"), + Elem: &schema.Resource{ + Schema: schemaMapOfDnsRecord(scalar_field_name), }, + } +} - "office_phone": { +func schemaOfDnsRecord(scalar_field_name string) *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: fmt.Sprintf("Single Element List of %s", "DnsRecord"), + Elem: &schema.Resource{ + Schema: schemaMapOfDnsRecord(scalar_field_name), + }, + } +} + +func schemaMapOfDnsRecord(scalar_field_name string) map[string]*schema.Schema { + return map[string]*schema.Schema{ + + "name": { Type: schema.TypeString, Computed: true, Description: "", }, - "first_name": { + "type": { Type: schema.TypeString, Computed: true, Description: "", }, - "manager": { + "data": { Type: schema.TypeString, Computed: true, Description: "", }, - "mobile_phone": { + "zone": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_home_folder_path": { + "timestamp": { Type: schema.TypeString, Computed: true, Description: "", }, + } +} - "rds_connect_drive": { - Type: schema.TypeBool, - Computed: true, - Description: "", +func schemaOfDnsZoneList(scalar_field_name string) *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: fmt.Sprintf("List of %s", "DnsZone"), + Elem: &schema.Resource{ + Schema: schemaMapOfDnsZone(scalar_field_name), + }, + } +} + +func schemaOfDnsZone(scalar_field_name string) *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: fmt.Sprintf("Single Element List of %s", "DnsZone"), + Elem: &schema.Resource{ + Schema: schemaMapOfDnsZone(scalar_field_name), }, + } +} - "description": { +func schemaMapOfDnsZone(scalar_field_name string) map[string]*schema.Schema { + return map[string]*schema.Schema{ + + "zone_type": { Type: schema.TypeString, Computed: true, Description: "", }, - "city": { + "type": { Type: schema.TypeString, Computed: true, Description: "", }, - "country": { + "distinguished_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_allow_logon": { - Type: schema.TypeBool, + "zone_name": { + Type: schema.TypeString, Computed: true, Description: "", }, + } +} - "username": { +func schemaOfGroupList(scalar_field_name string) *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: fmt.Sprintf("List of %s", "Group"), + Elem: &schema.Resource{ + Schema: schemaMapOfGroup(scalar_field_name), + }, + } +} + +func schemaOfGroup(scalar_field_name string) *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: fmt.Sprintf("Single Element List of %s", "Group"), + Elem: &schema.Resource{ + Schema: schemaMapOfGroup(scalar_field_name), + }, + } +} + +func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { + return map[string]*schema.Schema{ + + "name": { Type: schema.TypeString, Computed: true, Description: "", }, - "office": { + "scope": { Type: schema.TypeString, Computed: true, Description: "", }, - "company": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "job_title": { + "email": { Type: schema.TypeString, Computed: true, Description: "", }, - "postal_code": { + "ou_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "profile_path": { + "type": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_folder_drive": { + "guid": { Type: schema.TypeString, Computed: true, Description: "", diff --git a/provider/kopicloud.user-crud.gen.go b/provider/kopicloud.user-crud.gen.go index 76a8425..186453d 100644 --- a/provider/kopicloud.user-crud.gen.go +++ b/provider/kopicloud.user-crud.gen.go @@ -676,135 +676,135 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, m interface result := wrapInArray(resItems) - if err := d.Set("first_name", api_result.FirstName); err != nil { + if err := d.Set("first_name", res.JSON200.Result.FirstName); err != nil { return diag.FromErr(err) } - if err := d.Set("initials", api_result.Initials); err != nil { + if err := d.Set("initials", res.JSON200.Result.Initials); err != nil { return diag.FromErr(err) } - if err := d.Set("last_name", api_result.LastName); err != nil { + if err := d.Set("last_name", res.JSON200.Result.LastName); err != nil { return diag.FromErr(err) } - if err := d.Set("display_name", api_result.DisplayName); err != nil { + if err := d.Set("display_name", res.JSON200.Result.DisplayName); err != nil { return diag.FromErr(err) } - if err := d.Set("description", api_result.Description); err != nil { + if err := d.Set("description", res.JSON200.Result.Description); err != nil { return diag.FromErr(err) } - if err := d.Set("email_address", api_result.EmailAddress); err != nil { + if err := d.Set("email_address", res.JSON200.Result.EmailAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("department", api_result.Department); err != nil { + if err := d.Set("department", res.JSON200.Result.Department); err != nil { return diag.FromErr(err) } - if err := d.Set("office", api_result.Office); err != nil { + if err := d.Set("office", res.JSON200.Result.Office); err != nil { return diag.FromErr(err) } - if err := d.Set("company", api_result.Company); err != nil { + if err := d.Set("company", res.JSON200.Result.Company); err != nil { return diag.FromErr(err) } - if err := d.Set("change_password_next_logon", api_result.ChangePasswordNextLogon); err != nil { + if err := d.Set("change_password_next_logon", res.JSON200.Result.ChangePasswordNextLogon); err != nil { return diag.FromErr(err) } - if err := d.Set("password_never_expires", api_result.PasswordNeverExpired); err != nil { + if err := d.Set("password_never_expires", res.JSON200.Result.PasswordNeverExpired); err != nil { return diag.FromErr(err) } - if err := d.Set("ou_path", api_result.OuPath); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.OuPath); err != nil { return diag.FromErr(err) } - if err := d.Set("job_title", api_result.JobTitle); err != nil { + if err := d.Set("job_title", res.JSON200.Result.JobTitle); err != nil { return diag.FromErr(err) } - if err := d.Set("manager", api_result.Manager); err != nil { + if err := d.Set("manager", res.JSON200.Result.Manager); err != nil { return diag.FromErr(err) } - if err := d.Set("street", api_result.StreetAddress); err != nil { + if err := d.Set("street", res.JSON200.Result.StreetAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("po_box", api_result.StreetPoBox); err != nil { + if err := d.Set("po_box", res.JSON200.Result.StreetPoBox); err != nil { return diag.FromErr(err) } - if err := d.Set("city", api_result.City); err != nil { + if err := d.Set("city", res.JSON200.Result.City); err != nil { return diag.FromErr(err) } - if err := d.Set("state", api_result.State); err != nil { + if err := d.Set("state", res.JSON200.Result.State); err != nil { return diag.FromErr(err) } - if err := d.Set("zip_code", api_result.PostalCode); err != nil { + if err := d.Set("zip_code", res.JSON200.Result.PostalCode); err != nil { return diag.FromErr(err) } - if err := d.Set("country", api_result.Country); err != nil { + if err := d.Set("country", res.JSON200.Result.Country); err != nil { return diag.FromErr(err) } - if err := d.Set("office_phone", api_result.OfficePhone); err != nil { + if err := d.Set("office_phone", res.JSON200.Result.OfficePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("home_phone", api_result.HomePhone); err != nil { + if err := d.Set("home_phone", res.JSON200.Result.HomePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("mobile_phone", api_result.MobilePhone); err != nil { + if err := d.Set("mobile_phone", res.JSON200.Result.MobilePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_path", api_result.ProfilePath); err != nil { + if err := d.Set("profile_path", res.JSON200.Result.ProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_logon_script", api_result.ProfileLogonScript); err != nil { + if err := d.Set("profile_logon_script", res.JSON200.Result.ProfileLogonScript); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_path", api_result.HomeFolderPath); err != nil { + if err := d.Set("home_folder_path", res.JSON200.Result.HomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_drive", api_result.HomeFolderDrive); err != nil { + if err := d.Set("home_folder_drive", res.JSON200.Result.HomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_directory", api_result.HomeFolderDirectory); err != nil { + if err := d.Set("home_folder_directory", res.JSON200.Result.HomeFolderDirectory); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_profile_path", api_result.RdsProfilePath); err != nil { + if err := d.Set("rds_profile_path", res.JSON200.Result.RdsProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_path", api_result.RdsHomeFolderPath); err != nil { + if err := d.Set("rds_home_folder_path", res.JSON200.Result.RdsHomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_drive", api_result.RdsHomeFolderDrive); err != nil { + if err := d.Set("rds_home_folder_drive", res.JSON200.Result.RdsHomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_connect_drive", api_result.RdsConnectDrive); err != nil { + if err := d.Set("rds_connect_drive", res.JSON200.Result.RdsConnectDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_allow_logon", api_result.RdsAllowLogon); err != nil { + if err := d.Set("rds_allow_logon", res.JSON200.Result.RdsAllowLogon); err != nil { return diag.FromErr(err) } @@ -905,135 +905,135 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, m interface{} result := wrapInArray(resItems) - if err := d.Set("first_name", api_result.FirstName); err != nil { + if err := d.Set("first_name", res.JSON200.Result.FirstName); err != nil { return diag.FromErr(err) } - if err := d.Set("initials", api_result.Initials); err != nil { + if err := d.Set("initials", res.JSON200.Result.Initials); err != nil { return diag.FromErr(err) } - if err := d.Set("last_name", api_result.LastName); err != nil { + if err := d.Set("last_name", res.JSON200.Result.LastName); err != nil { return diag.FromErr(err) } - if err := d.Set("display_name", api_result.DisplayName); err != nil { + if err := d.Set("display_name", res.JSON200.Result.DisplayName); err != nil { return diag.FromErr(err) } - if err := d.Set("description", api_result.Description); err != nil { + if err := d.Set("description", res.JSON200.Result.Description); err != nil { return diag.FromErr(err) } - if err := d.Set("email_address", api_result.EmailAddress); err != nil { + if err := d.Set("email_address", res.JSON200.Result.EmailAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("department", api_result.Department); err != nil { + if err := d.Set("department", res.JSON200.Result.Department); err != nil { return diag.FromErr(err) } - if err := d.Set("office", api_result.Office); err != nil { + if err := d.Set("office", res.JSON200.Result.Office); err != nil { return diag.FromErr(err) } - if err := d.Set("company", api_result.Company); err != nil { + if err := d.Set("company", res.JSON200.Result.Company); err != nil { return diag.FromErr(err) } - if err := d.Set("change_password_next_logon", api_result.ChangePasswordNextLogon); err != nil { + if err := d.Set("change_password_next_logon", res.JSON200.Result.ChangePasswordNextLogon); err != nil { return diag.FromErr(err) } - if err := d.Set("password_never_expires", api_result.PasswordNeverExpired); err != nil { + if err := d.Set("password_never_expires", res.JSON200.Result.PasswordNeverExpired); err != nil { return diag.FromErr(err) } - if err := d.Set("ou_path", api_result.OuPath); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.OuPath); err != nil { return diag.FromErr(err) } - if err := d.Set("job_title", api_result.JobTitle); err != nil { + if err := d.Set("job_title", res.JSON200.Result.JobTitle); err != nil { return diag.FromErr(err) } - if err := d.Set("manager", api_result.Manager); err != nil { + if err := d.Set("manager", res.JSON200.Result.Manager); err != nil { return diag.FromErr(err) } - if err := d.Set("street", api_result.StreetAddress); err != nil { + if err := d.Set("street", res.JSON200.Result.StreetAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("po_box", api_result.StreetPoBox); err != nil { + if err := d.Set("po_box", res.JSON200.Result.StreetPoBox); err != nil { return diag.FromErr(err) } - if err := d.Set("city", api_result.City); err != nil { + if err := d.Set("city", res.JSON200.Result.City); err != nil { return diag.FromErr(err) } - if err := d.Set("state", api_result.State); err != nil { + if err := d.Set("state", res.JSON200.Result.State); err != nil { return diag.FromErr(err) } - if err := d.Set("zip_code", api_result.PostalCode); err != nil { + if err := d.Set("zip_code", res.JSON200.Result.PostalCode); err != nil { return diag.FromErr(err) } - if err := d.Set("country", api_result.Country); err != nil { + if err := d.Set("country", res.JSON200.Result.Country); err != nil { return diag.FromErr(err) } - if err := d.Set("office_phone", api_result.OfficePhone); err != nil { + if err := d.Set("office_phone", res.JSON200.Result.OfficePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("home_phone", api_result.HomePhone); err != nil { + if err := d.Set("home_phone", res.JSON200.Result.HomePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("mobile_phone", api_result.MobilePhone); err != nil { + if err := d.Set("mobile_phone", res.JSON200.Result.MobilePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_path", api_result.ProfilePath); err != nil { + if err := d.Set("profile_path", res.JSON200.Result.ProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_logon_script", api_result.ProfileLogonScript); err != nil { + if err := d.Set("profile_logon_script", res.JSON200.Result.ProfileLogonScript); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_path", api_result.HomeFolderPath); err != nil { + if err := d.Set("home_folder_path", res.JSON200.Result.HomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_drive", api_result.HomeFolderDrive); err != nil { + if err := d.Set("home_folder_drive", res.JSON200.Result.HomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_directory", api_result.HomeFolderDirectory); err != nil { + if err := d.Set("home_folder_directory", res.JSON200.Result.HomeFolderDirectory); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_profile_path", api_result.RdsProfilePath); err != nil { + if err := d.Set("rds_profile_path", res.JSON200.Result.RdsProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_path", api_result.RdsHomeFolderPath); err != nil { + if err := d.Set("rds_home_folder_path", res.JSON200.Result.RdsHomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_drive", api_result.RdsHomeFolderDrive); err != nil { + if err := d.Set("rds_home_folder_drive", res.JSON200.Result.RdsHomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_connect_drive", api_result.RdsConnectDrive); err != nil { + if err := d.Set("rds_connect_drive", res.JSON200.Result.RdsConnectDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_allow_logon", api_result.RdsAllowLogon); err != nil { + if err := d.Set("rds_allow_logon", res.JSON200.Result.RdsAllowLogon); err != nil { return diag.FromErr(err) } @@ -1131,135 +1131,135 @@ func resourceUserDelete(ctx context.Context, d *schema.ResourceData, m interface result := wrapInArray(resItems) - if err := d.Set("first_name", api_result.FirstName); err != nil { + if err := d.Set("first_name", res.JSON200.Result.FirstName); err != nil { return diag.FromErr(err) } - if err := d.Set("initials", api_result.Initials); err != nil { + if err := d.Set("initials", res.JSON200.Result.Initials); err != nil { return diag.FromErr(err) } - if err := d.Set("last_name", api_result.LastName); err != nil { + if err := d.Set("last_name", res.JSON200.Result.LastName); err != nil { return diag.FromErr(err) } - if err := d.Set("display_name", api_result.DisplayName); err != nil { + if err := d.Set("display_name", res.JSON200.Result.DisplayName); err != nil { return diag.FromErr(err) } - if err := d.Set("description", api_result.Description); err != nil { + if err := d.Set("description", res.JSON200.Result.Description); err != nil { return diag.FromErr(err) } - if err := d.Set("email_address", api_result.EmailAddress); err != nil { + if err := d.Set("email_address", res.JSON200.Result.EmailAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("department", api_result.Department); err != nil { + if err := d.Set("department", res.JSON200.Result.Department); err != nil { return diag.FromErr(err) } - if err := d.Set("office", api_result.Office); err != nil { + if err := d.Set("office", res.JSON200.Result.Office); err != nil { return diag.FromErr(err) } - if err := d.Set("company", api_result.Company); err != nil { + if err := d.Set("company", res.JSON200.Result.Company); err != nil { return diag.FromErr(err) } - if err := d.Set("change_password_next_logon", api_result.ChangePasswordNextLogon); err != nil { + if err := d.Set("change_password_next_logon", res.JSON200.Result.ChangePasswordNextLogon); err != nil { return diag.FromErr(err) } - if err := d.Set("password_never_expires", api_result.PasswordNeverExpired); err != nil { + if err := d.Set("password_never_expires", res.JSON200.Result.PasswordNeverExpired); err != nil { return diag.FromErr(err) } - if err := d.Set("ou_path", api_result.OuPath); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.OuPath); err != nil { return diag.FromErr(err) } - if err := d.Set("job_title", api_result.JobTitle); err != nil { + if err := d.Set("job_title", res.JSON200.Result.JobTitle); err != nil { return diag.FromErr(err) } - if err := d.Set("manager", api_result.Manager); err != nil { + if err := d.Set("manager", res.JSON200.Result.Manager); err != nil { return diag.FromErr(err) } - if err := d.Set("street", api_result.StreetAddress); err != nil { + if err := d.Set("street", res.JSON200.Result.StreetAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("po_box", api_result.StreetPoBox); err != nil { + if err := d.Set("po_box", res.JSON200.Result.StreetPoBox); err != nil { return diag.FromErr(err) } - if err := d.Set("city", api_result.City); err != nil { + if err := d.Set("city", res.JSON200.Result.City); err != nil { return diag.FromErr(err) } - if err := d.Set("state", api_result.State); err != nil { + if err := d.Set("state", res.JSON200.Result.State); err != nil { return diag.FromErr(err) } - if err := d.Set("zip_code", api_result.PostalCode); err != nil { + if err := d.Set("zip_code", res.JSON200.Result.PostalCode); err != nil { return diag.FromErr(err) } - if err := d.Set("country", api_result.Country); err != nil { + if err := d.Set("country", res.JSON200.Result.Country); err != nil { return diag.FromErr(err) } - if err := d.Set("office_phone", api_result.OfficePhone); err != nil { + if err := d.Set("office_phone", res.JSON200.Result.OfficePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("home_phone", api_result.HomePhone); err != nil { + if err := d.Set("home_phone", res.JSON200.Result.HomePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("mobile_phone", api_result.MobilePhone); err != nil { + if err := d.Set("mobile_phone", res.JSON200.Result.MobilePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_path", api_result.ProfilePath); err != nil { + if err := d.Set("profile_path", res.JSON200.Result.ProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_logon_script", api_result.ProfileLogonScript); err != nil { + if err := d.Set("profile_logon_script", res.JSON200.Result.ProfileLogonScript); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_path", api_result.HomeFolderPath); err != nil { + if err := d.Set("home_folder_path", res.JSON200.Result.HomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_drive", api_result.HomeFolderDrive); err != nil { + if err := d.Set("home_folder_drive", res.JSON200.Result.HomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_directory", api_result.HomeFolderDirectory); err != nil { + if err := d.Set("home_folder_directory", res.JSON200.Result.HomeFolderDirectory); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_profile_path", api_result.RdsProfilePath); err != nil { + if err := d.Set("rds_profile_path", res.JSON200.Result.RdsProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_path", api_result.RdsHomeFolderPath); err != nil { + if err := d.Set("rds_home_folder_path", res.JSON200.Result.RdsHomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_drive", api_result.RdsHomeFolderDrive); err != nil { + if err := d.Set("rds_home_folder_drive", res.JSON200.Result.RdsHomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_connect_drive", api_result.RdsConnectDrive); err != nil { + if err := d.Set("rds_connect_drive", res.JSON200.Result.RdsConnectDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_allow_logon", api_result.RdsAllowLogon); err != nil { + if err := d.Set("rds_allow_logon", res.JSON200.Result.RdsAllowLogon); err != nil { return diag.FromErr(err) } diff --git a/provider/kopicloud.user-disable-crud.gen.go b/provider/kopicloud.user-disable-crud.gen.go index eaaa28a..3fbb7ac 100644 --- a/provider/kopicloud.user-disable-crud.gen.go +++ b/provider/kopicloud.user-disable-crud.gen.go @@ -29,6 +29,18 @@ func resourceUserDisableAccount() *schema.Resource { Description: "", } + terraformSchema["result"] = &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: false, + Required: false, + Sensitive: false, + + ForceNew: true, + + Description: "", + } + terraformSchema["show_fields"] = &schema.Schema{ Type: schema.TypeString, Computed: false, @@ -41,8 +53,6 @@ func resourceUserDisableAccount() *schema.Resource { Description: "", } - terraformSchema["result"] = schemaOfUser(``) - return &schema.Resource{ CreateContext: resourceUserDisableAccountCreate, @@ -134,10 +144,12 @@ func resourceUserDisableAccountCreate(ctx context.Context, d *schema.ResourceDat result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -233,10 +245,12 @@ func resourceUserDisableAccountRead(ctx context.Context, d *schema.ResourceData, result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -332,10 +346,12 @@ func resourceUserDisableAccountDelete(ctx context.Context, d *schema.ResourceDat result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId("") } diff --git a/provider/kopicloud.user-enable-crud.gen.go b/provider/kopicloud.user-enable-crud.gen.go index 90c2690..086907c 100644 --- a/provider/kopicloud.user-enable-crud.gen.go +++ b/provider/kopicloud.user-enable-crud.gen.go @@ -29,6 +29,18 @@ func resourceUserEnableAccount() *schema.Resource { Description: "", } + terraformSchema["result"] = &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: false, + Required: false, + Sensitive: false, + + ForceNew: true, + + Description: "", + } + terraformSchema["show_fields"] = &schema.Schema{ Type: schema.TypeString, Computed: false, @@ -41,8 +53,6 @@ func resourceUserEnableAccount() *schema.Resource { Description: "", } - terraformSchema["result"] = schemaOfUser(``) - return &schema.Resource{ CreateContext: resourceUserEnableAccountCreate, @@ -134,10 +144,12 @@ func resourceUserEnableAccountCreate(ctx context.Context, d *schema.ResourceData result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -233,10 +245,12 @@ func resourceUserEnableAccountRead(ctx context.Context, d *schema.ResourceData, result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -332,10 +346,12 @@ func resourceUserEnableAccountDelete(ctx context.Context, d *schema.ResourceData result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId("") } diff --git a/provider/kopicloud.user-password-reset-crud.gen.go b/provider/kopicloud.user-password-reset-crud.gen.go index c945543..fe1bdaa 100644 --- a/provider/kopicloud.user-password-reset-crud.gen.go +++ b/provider/kopicloud.user-password-reset-crud.gen.go @@ -55,6 +55,18 @@ func resourceUserPasswordReset() *schema.Resource { Description: "", } + terraformSchema["result"] = &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: false, + Required: false, + Sensitive: false, + + ForceNew: true, + + Description: "", + } + terraformSchema["show_fields"] = &schema.Schema{ Type: schema.TypeString, Computed: false, @@ -67,8 +79,6 @@ func resourceUserPasswordReset() *schema.Resource { Description: "", } - terraformSchema["result"] = schemaOfUser(``) - return &schema.Resource{ CreateContext: resourceUserPasswordResetCreate, @@ -172,10 +182,12 @@ func resourceUserPasswordResetCreate(ctx context.Context, d *schema.ResourceData result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -271,10 +283,12 @@ func resourceUserPasswordResetRead(ctx context.Context, d *schema.ResourceData, result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -370,10 +384,12 @@ func resourceUserPasswordResetDelete(ctx context.Context, d *schema.ResourceData result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId("") } diff --git a/provider/kopicloud.user-rename.gen.go b/provider/kopicloud.user-rename.gen.go index 51077d7..169c5bb 100644 --- a/provider/kopicloud.user-rename.gen.go +++ b/provider/kopicloud.user-rename.gen.go @@ -53,6 +53,18 @@ func resourceUserRename() *schema.Resource { Description: "", } + terraformSchema["result"] = &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: false, + Required: false, + Sensitive: false, + + ForceNew: true, + + Description: "", + } + terraformSchema["show_fields"] = &schema.Schema{ Type: schema.TypeString, Computed: false, @@ -65,7 +77,7 @@ func resourceUserRename() *schema.Resource { Description: "", } - terraformSchema["result"] = schemaOfUser(``) + terraformSchema["user"] = schemaOfUser(``) return &schema.Resource{ @@ -163,7 +175,11 @@ func resourceUserRenameCreate(ctx context.Context, d *schema.ResourceData, m int result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { + return diag.FromErr(err) + } + + if err := d.Set("user", result); err != nil { return diag.FromErr(err) } @@ -262,7 +278,11 @@ func resourceUserRenameRead(ctx context.Context, d *schema.ResourceData, m inter result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { + return diag.FromErr(err) + } + + if err := d.Set("user", result); err != nil { return diag.FromErr(err) } @@ -361,7 +381,11 @@ func resourceUserRenameDelete(ctx context.Context, d *schema.ResourceData, m int result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { + return diag.FromErr(err) + } + + if err := d.Set("user", result); err != nil { return diag.FromErr(err) } diff --git a/provider/kopicloud.user-unlock-crud.gen.go b/provider/kopicloud.user-unlock-crud.gen.go index e29192d..b3afbc0 100644 --- a/provider/kopicloud.user-unlock-crud.gen.go +++ b/provider/kopicloud.user-unlock-crud.gen.go @@ -29,6 +29,18 @@ func resourceUserUnlockAccount() *schema.Resource { Description: "", } + terraformSchema["result"] = &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: false, + Required: false, + Sensitive: false, + + ForceNew: true, + + Description: "", + } + terraformSchema["show_fields"] = &schema.Schema{ Type: schema.TypeString, Computed: false, @@ -134,10 +146,12 @@ func resourceUserUnlockAccountCreate(ctx context.Context, d *schema.ResourceData result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -233,10 +247,12 @@ func resourceUserUnlockAccountRead(ctx context.Context, d *schema.ResourceData, result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId(getId_for_User(api_result)) } @@ -332,10 +348,12 @@ func resourceUserUnlockAccountDelete(ctx context.Context, d *schema.ResourceData result := wrapInArray(resItems) - if err := d.Set("result", result); err != nil { + if err := d.Set("result", res.JSON200.Output); err != nil { return diag.FromErr(err) } + tflog.Debug(ctx, fmt.Sprintf("Ignoring result: %#v", result)) + d.SetId("") } diff --git a/provider/kopicloud.user-update.gen.go b/provider/kopicloud.user-update.gen.go index 34e8a47..388f28b 100644 --- a/provider/kopicloud.user-update.gen.go +++ b/provider/kopicloud.user-update.gen.go @@ -233,135 +233,135 @@ func resourceUser_Update_0(ctx context.Context, d *schema.ResourceData, m interf result := wrapInArray(resItems) - if err := d.Set("first_name", api_result.FirstName); err != nil { + if err := d.Set("first_name", res.JSON200.Result.FirstName); err != nil { return diag.FromErr(err) } - if err := d.Set("initials", api_result.Initials); err != nil { + if err := d.Set("initials", res.JSON200.Result.Initials); err != nil { return diag.FromErr(err) } - if err := d.Set("last_name", api_result.LastName); err != nil { + if err := d.Set("last_name", res.JSON200.Result.LastName); err != nil { return diag.FromErr(err) } - if err := d.Set("display_name", api_result.DisplayName); err != nil { + if err := d.Set("display_name", res.JSON200.Result.DisplayName); err != nil { return diag.FromErr(err) } - if err := d.Set("description", api_result.Description); err != nil { + if err := d.Set("description", res.JSON200.Result.Description); err != nil { return diag.FromErr(err) } - if err := d.Set("email_address", api_result.EmailAddress); err != nil { + if err := d.Set("email_address", res.JSON200.Result.EmailAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("department", api_result.Department); err != nil { + if err := d.Set("department", res.JSON200.Result.Department); err != nil { return diag.FromErr(err) } - if err := d.Set("office", api_result.Office); err != nil { + if err := d.Set("office", res.JSON200.Result.Office); err != nil { return diag.FromErr(err) } - if err := d.Set("company", api_result.Company); err != nil { + if err := d.Set("company", res.JSON200.Result.Company); err != nil { return diag.FromErr(err) } - if err := d.Set("change_password_next_logon", api_result.ChangePasswordNextLogon); err != nil { + if err := d.Set("change_password_next_logon", res.JSON200.Result.ChangePasswordNextLogon); err != nil { return diag.FromErr(err) } - if err := d.Set("password_never_expires", api_result.PasswordNeverExpired); err != nil { + if err := d.Set("password_never_expires", res.JSON200.Result.PasswordNeverExpired); err != nil { return diag.FromErr(err) } - if err := d.Set("ou_path", api_result.OuPath); err != nil { + if err := d.Set("ou_path", res.JSON200.Result.OuPath); err != nil { return diag.FromErr(err) } - if err := d.Set("job_title", api_result.JobTitle); err != nil { + if err := d.Set("job_title", res.JSON200.Result.JobTitle); err != nil { return diag.FromErr(err) } - if err := d.Set("manager", api_result.Manager); err != nil { + if err := d.Set("manager", res.JSON200.Result.Manager); err != nil { return diag.FromErr(err) } - if err := d.Set("street", api_result.StreetAddress); err != nil { + if err := d.Set("street", res.JSON200.Result.StreetAddress); err != nil { return diag.FromErr(err) } - if err := d.Set("po_box", api_result.StreetPoBox); err != nil { + if err := d.Set("po_box", res.JSON200.Result.StreetPoBox); err != nil { return diag.FromErr(err) } - if err := d.Set("city", api_result.City); err != nil { + if err := d.Set("city", res.JSON200.Result.City); err != nil { return diag.FromErr(err) } - if err := d.Set("state", api_result.State); err != nil { + if err := d.Set("state", res.JSON200.Result.State); err != nil { return diag.FromErr(err) } - if err := d.Set("zip_code", api_result.PostalCode); err != nil { + if err := d.Set("zip_code", res.JSON200.Result.PostalCode); err != nil { return diag.FromErr(err) } - if err := d.Set("country", api_result.Country); err != nil { + if err := d.Set("country", res.JSON200.Result.Country); err != nil { return diag.FromErr(err) } - if err := d.Set("office_phone", api_result.OfficePhone); err != nil { + if err := d.Set("office_phone", res.JSON200.Result.OfficePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("home_phone", api_result.HomePhone); err != nil { + if err := d.Set("home_phone", res.JSON200.Result.HomePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("mobile_phone", api_result.MobilePhone); err != nil { + if err := d.Set("mobile_phone", res.JSON200.Result.MobilePhone); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_path", api_result.ProfilePath); err != nil { + if err := d.Set("profile_path", res.JSON200.Result.ProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("profile_logon_script", api_result.ProfileLogonScript); err != nil { + if err := d.Set("profile_logon_script", res.JSON200.Result.ProfileLogonScript); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_path", api_result.HomeFolderPath); err != nil { + if err := d.Set("home_folder_path", res.JSON200.Result.HomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_drive", api_result.HomeFolderDrive); err != nil { + if err := d.Set("home_folder_drive", res.JSON200.Result.HomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("home_folder_directory", api_result.HomeFolderDirectory); err != nil { + if err := d.Set("home_folder_directory", res.JSON200.Result.HomeFolderDirectory); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_profile_path", api_result.RdsProfilePath); err != nil { + if err := d.Set("rds_profile_path", res.JSON200.Result.RdsProfilePath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_path", api_result.RdsHomeFolderPath); err != nil { + if err := d.Set("rds_home_folder_path", res.JSON200.Result.RdsHomeFolderPath); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_home_folder_drive", api_result.RdsHomeFolderDrive); err != nil { + if err := d.Set("rds_home_folder_drive", res.JSON200.Result.RdsHomeFolderDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_connect_drive", api_result.RdsConnectDrive); err != nil { + if err := d.Set("rds_connect_drive", res.JSON200.Result.RdsConnectDrive); err != nil { return diag.FromErr(err) } - if err := d.Set("rds_allow_logon", api_result.RdsAllowLogon); err != nil { + if err := d.Set("rds_allow_logon", res.JSON200.Result.RdsAllowLogon); err != nil { return diag.FromErr(err) }