From ba1534463c1e9b075262f62d6fa6662904afc480 Mon Sep 17 00:00:00 2001 From: Oscar Forero Date: Sat, 18 Mar 2023 23:58:57 +0100 Subject: [PATCH] Make the new_password optional Make new_password attribute optional --- docs/resources/kopicloud_user.md | 2 +- generator-inputs/user.json | 2 +- generator-inputs/user_password_reset.json | 3 +- provider/kopicloud.converters.gen.go | 296 +++++++++---------- provider/kopicloud.schemas.gen.go | 330 +++++++++++----------- provider/kopicloud.user-crud.gen.go | 4 +- 6 files changed, 319 insertions(+), 318 deletions(-) diff --git a/docs/resources/kopicloud_user.md b/docs/resources/kopicloud_user.md index 1cf06ef..9104420 100644 --- a/docs/resources/kopicloud_user.md +++ b/docs/resources/kopicloud_user.md @@ -17,7 +17,6 @@ Element to create, update, delete Users from Active Directory ### Required -- `new_password` (String) - `password` (String) - `username` (String) @@ -32,6 +31,7 @@ Element to create, update, delete Users from Active Directory - `first_name` (String) - `initials` (String) - `last_name` (String) +- `new_password` (String) - `office` (String) - `ou_path` (String) - `show_fields` (String) diff --git a/generator-inputs/user.json b/generator-inputs/user.json index 73e693d..a9d448d 100644 --- a/generator-inputs/user.json +++ b/generator-inputs/user.json @@ -152,7 +152,7 @@ { "name": "new_password", "type": "schema.TypeString", - "required": true + "optional": true }, { "name": "change_password_net_logon", diff --git a/generator-inputs/user_password_reset.json b/generator-inputs/user_password_reset.json index 541ffe0..59d90bd 100644 --- a/generator-inputs/user_password_reset.json +++ b/generator-inputs/user_password_reset.json @@ -40,7 +40,8 @@ }, "element_name": "UserPasswordReset", - "create": { + "create": + { "api_function": { "name": "PostApiADUserUsernameResetPasswordWithResponse", "isPointer": true, diff --git a/provider/kopicloud.converters.gen.go b/provider/kopicloud.converters.gen.go index 0969129..2efc2e5 100644 --- a/provider/kopicloud.converters.gen.go +++ b/provider/kopicloud.converters.gen.go @@ -43,15 +43,15 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.Manager != nil && isNotEmpty(obj.Manager) { + if obj.StreetAddress != nil && isNotEmpty(obj.StreetAddress) { - result["manager"] = obj.Manager + result["street_address"] = obj.StreetAddress } - if obj.StreetAddress != nil && isNotEmpty(obj.StreetAddress) { + if obj.RdsHomeFolderPath != nil && isNotEmpty(obj.RdsHomeFolderPath) { - result["street_address"] = obj.StreetAddress + result["rds_home_folder_path"] = obj.RdsHomeFolderPath } @@ -61,39 +61,45 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.ChangePasswordNextLogon != nil && isNotEmpty(obj.ChangePasswordNextLogon) { + if obj.HomeFolderDrive != nil && isNotEmpty(obj.HomeFolderDrive) { - result["change_password_next_logon"] = obj.ChangePasswordNextLogon + result["home_folder_drive"] = obj.HomeFolderDrive } - if obj.DisplayName != nil && isNotEmpty(obj.DisplayName) { + if obj.RdsConnectDrive != nil && isNotEmpty(obj.RdsConnectDrive) { - result["display_name"] = obj.DisplayName + result["rds_connect_drive"] = obj.RdsConnectDrive } - if obj.MobilePhone != nil && isNotEmpty(obj.MobilePhone) { + if obj.Username != nil && isNotEmpty(obj.Username) { - result["mobile_phone"] = obj.MobilePhone + result["username"] = obj.Username } - if obj.HomeFolderDrive != nil && isNotEmpty(obj.HomeFolderDrive) { + if obj.Description != nil && isNotEmpty(obj.Description) { - result["home_folder_drive"] = obj.HomeFolderDrive + result["description"] = obj.Description } - if obj.RdsConnectDrive != nil && isNotEmpty(obj.RdsConnectDrive) { + if obj.Initials != nil && isNotEmpty(obj.Initials) { - result["rds_connect_drive"] = obj.RdsConnectDrive + result["initials"] = obj.Initials } - if obj.HomePhone != nil && isNotEmpty(obj.HomePhone) { + if obj.ProfileLogonScript != nil && isNotEmpty(obj.ProfileLogonScript) { - result["home_phone"] = obj.HomePhone + result["profile_logon_script"] = obj.ProfileLogonScript + + } + + if obj.OuPath != nil && isNotEmpty(obj.OuPath) { + + result["ou_path"] = obj.OuPath } @@ -103,15 +109,15 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.SamUsername != nil && isNotEmpty(obj.SamUsername) { + if obj.RdsHomeFolderDrive != nil && isNotEmpty(obj.RdsHomeFolderDrive) { - result["sam_username"] = obj.SamUsername + result["rds_home_folder_drive"] = obj.RdsHomeFolderDrive } - if obj.Initials != nil && isNotEmpty(obj.Initials) { + if obj.Manager != nil && isNotEmpty(obj.Manager) { - result["initials"] = obj.Initials + result["manager"] = obj.Manager } @@ -121,21 +127,21 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.PostalCode != nil && isNotEmpty(obj.PostalCode) { + if obj.Country != nil && isNotEmpty(obj.Country) { - result["postal_code"] = obj.PostalCode + result["country"] = obj.Country } - if obj.Country != nil && isNotEmpty(obj.Country) { + if obj.RdsAllowLogon != nil && isNotEmpty(obj.RdsAllowLogon) { - result["country"] = obj.Country + result["rds_allow_logon"] = obj.RdsAllowLogon } - if obj.Username != nil && isNotEmpty(obj.Username) { + if obj.FirstName != nil && isNotEmpty(obj.FirstName) { - result["username"] = obj.Username + result["first_name"] = obj.FirstName } @@ -145,45 +151,45 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.RdsHomeFolderPath != nil && isNotEmpty(obj.RdsHomeFolderPath) { + if obj.Department != nil && isNotEmpty(obj.Department) { - result["rds_home_folder_path"] = obj.RdsHomeFolderPath + result["department"] = obj.Department } - if obj.RdsHomeFolderDrive != nil && isNotEmpty(obj.RdsHomeFolderDrive) { + if obj.ChangePasswordNextLogon != nil && isNotEmpty(obj.ChangePasswordNextLogon) { - result["rds_home_folder_drive"] = obj.RdsHomeFolderDrive + result["change_password_next_logon"] = obj.ChangePasswordNextLogon } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.DisplayName != nil && isNotEmpty(obj.DisplayName) { - result["description"] = obj.Description + result["display_name"] = obj.DisplayName } - 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.HomePhone != nil && isNotEmpty(obj.HomePhone) { - result["ou_path"] = obj.OuPath + result["home_phone"] = obj.HomePhone } - if obj.City != nil && isNotEmpty(obj.City) { + if obj.MobilePhone != nil && isNotEmpty(obj.MobilePhone) { - result["city"] = obj.City + result["mobile_phone"] = obj.MobilePhone } - if obj.State != nil && isNotEmpty(obj.State) { + if obj.ProfilePath != nil && isNotEmpty(obj.ProfilePath) { - result["state"] = obj.State + result["profile_path"] = obj.ProfilePath } @@ -193,57 +199,51 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.JobTitle != nil && isNotEmpty(obj.JobTitle) { - - result["job_title"] = obj.JobTitle - - } - - if obj.ProfilePath != nil && isNotEmpty(obj.ProfilePath) { + if obj.Company != nil && isNotEmpty(obj.Company) { - result["profile_path"] = obj.ProfilePath + result["company"] = obj.Company } - if obj.HomeFolderDirectory != nil && isNotEmpty(obj.HomeFolderDirectory) { + if obj.JobTitle != nil && isNotEmpty(obj.JobTitle) { - result["home_folder_directory"] = obj.HomeFolderDirectory + result["job_title"] = obj.JobTitle } - if obj.RdsAllowLogon != nil && isNotEmpty(obj.RdsAllowLogon) { + if obj.State != nil && isNotEmpty(obj.State) { - result["rds_allow_logon"] = obj.RdsAllowLogon + result["state"] = obj.State } - if obj.FirstName != nil && isNotEmpty(obj.FirstName) { + if obj.HomeFolderDirectory != nil && isNotEmpty(obj.HomeFolderDirectory) { - result["first_name"] = obj.FirstName + result["home_folder_directory"] = obj.HomeFolderDirectory } - if obj.Department != nil && isNotEmpty(obj.Department) { + if obj.Office != nil && isNotEmpty(obj.Office) { - result["department"] = obj.Department + result["office"] = obj.Office } - if obj.Company != nil && isNotEmpty(obj.Company) { + if obj.SamUsername != nil && isNotEmpty(obj.SamUsername) { - result["company"] = obj.Company + result["sam_username"] = obj.SamUsername } - if obj.OfficePhone != nil && isNotEmpty(obj.OfficePhone) { + if obj.City != nil && isNotEmpty(obj.City) { - result["office_phone"] = obj.OfficePhone + result["city"] = obj.City } - if obj.ProfileLogonScript != nil && isNotEmpty(obj.ProfileLogonScript) { + if obj.PostalCode != nil && isNotEmpty(obj.PostalCode) { - result["profile_logon_script"] = obj.ProfileLogonScript + result["postal_code"] = obj.PostalCode } @@ -261,38 +261,49 @@ func UserListToTerraform(list *[]api.User) []interface{} { return make([]interface{}, 0) } -func ComputerToTerraform(obj *api.Computer) map[string]interface{} { +func DnsZoneToTerraform(obj *api.DnsZone) map[string]interface{} { result := make(map[string]interface{}) - if obj.OperatingSystem != nil && isNotEmpty(obj.OperatingSystem) { + if obj.ZoneType != nil && isNotEmpty(obj.ZoneType) { - result["operating_system"] = obj.OperatingSystem + result["zone_type"] = obj.ZoneType } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["description"] = obj.Description + result["type"] = obj.Type } - if obj.DnsName != nil && isNotEmpty(obj.DnsName) { + if obj.DistinguishedName != nil && isNotEmpty(obj.DistinguishedName) { - result["dns_name"] = obj.DnsName + result["distinguished_name"] = obj.DistinguishedName } - if obj.Path != nil && isNotEmpty(obj.Path) { + if obj.ZoneName != nil && isNotEmpty(obj.ZoneName) { - result["path"] = obj.Path + result["zone_name"] = obj.ZoneName } - if obj.Created != nil && isNotEmpty(obj.Created) { - - result["created"] = obj.Created + 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) +} + +func ComputerToTerraform(obj *api.Computer) map[string]interface{} { + result := make(map[string]interface{}) if obj.Sid != nil && isNotEmpty(obj.Sid) { @@ -306,68 +317,51 @@ func ComputerToTerraform(obj *api.Computer) map[string]interface{} { } - return result -} - -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 DnsRecordToTerraform(obj *api.DnsRecord) map[string]interface{} { - result := make(map[string]interface{}) - - if obj.Name != nil && isNotEmpty(obj.Name) { + if obj.OperatingSystem != nil && isNotEmpty(obj.OperatingSystem) { - result["name"] = obj.Name + result["operating_system"] = obj.OperatingSystem } - if obj.Type != nil && isNotEmpty(obj.Type) { + if obj.Description != nil && isNotEmpty(obj.Description) { - result["type"] = obj.Type + result["description"] = obj.Description } - if obj.Data != nil && isNotEmpty(obj.Data) { + if obj.DnsName != nil && isNotEmpty(obj.DnsName) { - result["data"] = obj.Data + result["dns_name"] = obj.DnsName } - if obj.Zone != nil && isNotEmpty(obj.Zone) { + if obj.Path != nil && isNotEmpty(obj.Path) { - result["zone"] = obj.Zone + result["path"] = obj.Path } - if obj.Timestamp != nil && isNotEmpty(obj.Timestamp) { + if obj.Created != nil && isNotEmpty(obj.Created) { - result["timestamp"] = obj.Timestamp + result["created"] = obj.Created } 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 GroupToTerraform(obj *api.Group) map[string]interface{} { +func OUToTerraform(obj *api.OU) map[string]interface{} { result := make(map[string]interface{}) if obj.Name != nil && isNotEmpty(obj.Name) { @@ -376,33 +370,21 @@ func GroupToTerraform(obj *api.Group) map[string]interface{} { } - if obj.Scope != nil && isNotEmpty(obj.Scope) { - - result["scope"] = obj.Scope - - } - if obj.Description != nil && isNotEmpty(obj.Description) { result["description"] = obj.Description } - if obj.Email != nil && isNotEmpty(obj.Email) { - - result["email"] = obj.Email - - } - - if obj.OuPath != nil && isNotEmpty(obj.OuPath) { + if obj.Path != nil && isNotEmpty(obj.Path) { - result["ou_path"] = obj.OuPath + result["path"] = obj.Path } - if obj.Type != nil && isNotEmpty(obj.Type) { + if obj.Protected != nil && isNotEmpty(obj.Protected) { - result["type"] = obj.Type + result["protected"] = obj.Protected } @@ -415,82 +397,82 @@ func GroupToTerraform(obj *api.Group) map[string]interface{} { return result } -func GroupListToTerraform(list *[]api.Group) []interface{} { +func OUListToTerraform(list *[]api.OU) []interface{} { if list != nil { results := make([]interface{}, len(*list)) - for i, Group := range *list { - results[i] = GroupToTerraform(&Group) + for i, OU := range *list { + results[i] = OUToTerraform(&OU) } 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.Guid != nil && isNotEmpty(obj.Guid) { + if obj.Data != nil && isNotEmpty(obj.Data) { - result["guid"] = UuidToTerraform(obj.Guid) + result["data"] = obj.Data } - if obj.Name != nil && isNotEmpty(obj.Name) { + if obj.Zone != nil && isNotEmpty(obj.Zone) { - result["name"] = obj.Name + result["zone"] = obj.Zone } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.Timestamp != nil && isNotEmpty(obj.Timestamp) { - result["description"] = obj.Description + result["timestamp"] = obj.Timestamp } - if obj.Path != nil && isNotEmpty(obj.Path) { + if obj.Name != nil && isNotEmpty(obj.Name) { - result["path"] = obj.Path + result["name"] = obj.Name } - if obj.Protected != nil && isNotEmpty(obj.Protected) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["protected"] = obj.Protected + result["type"] = obj.Type } 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 } return make([]interface{}, 0) } -func DnsZoneToTerraform(obj *api.DnsZone) map[string]interface{} { +func GroupToTerraform(obj *api.Group) map[string]interface{} { result := make(map[string]interface{}) - if obj.DistinguishedName != nil && isNotEmpty(obj.DistinguishedName) { + if obj.Description != nil && isNotEmpty(obj.Description) { - result["distinguished_name"] = obj.DistinguishedName + result["description"] = obj.Description } - if obj.ZoneName != nil && isNotEmpty(obj.ZoneName) { + if obj.Email != nil && isNotEmpty(obj.Email) { - result["zone_name"] = obj.ZoneName + result["email"] = obj.Email } - if obj.ZoneType != nil && isNotEmpty(obj.ZoneType) { + if obj.OuPath != nil && isNotEmpty(obj.OuPath) { - result["zone_type"] = obj.ZoneType + result["ou_path"] = obj.OuPath } @@ -500,14 +482,32 @@ func DnsZoneToTerraform(obj *api.DnsZone) map[string]interface{} { } + if obj.Guid != nil && isNotEmpty(obj.Guid) { + + result["guid"] = UuidToTerraform(obj.Guid) + + } + + if obj.Name != nil && isNotEmpty(obj.Name) { + + result["name"] = obj.Name + + } + + if obj.Scope != nil && isNotEmpty(obj.Scope) { + + result["scope"] = obj.Scope + + } + return result } -func DnsZoneListToTerraform(list *[]api.DnsZone) []interface{} { +func GroupListToTerraform(list *[]api.Group) []interface{} { if list != nil { results := make([]interface{}, len(*list)) - for i, DnsZone := range *list { - results[i] = DnsZoneToTerraform(&DnsZone) + for i, Group := range *list { + results[i] = GroupToTerraform(&Group) } return results } diff --git a/provider/kopicloud.schemas.gen.go b/provider/kopicloud.schemas.gen.go index 5977644..35d691b 100644 --- a/provider/kopicloud.schemas.gen.go +++ b/provider/kopicloud.schemas.gen.go @@ -37,68 +37,50 @@ func schemaMapOfScalarElement(t schema.ValueType, field_name string) map[string] } } -func schemaOfComputerList(scalar_field_name string) *schema.Schema { +func schemaOfDnsZoneList(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("List of %s", "Computer"), + Description: fmt.Sprintf("List of %s", "DnsZone"), Elem: &schema.Resource{ - Schema: schemaMapOfComputer(scalar_field_name), + Schema: schemaMapOfDnsZone(scalar_field_name), }, } } -func schemaOfComputer(scalar_field_name string) *schema.Schema { +func schemaOfDnsZone(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "Computer"), + Description: fmt.Sprintf("Single Element List of %s", "DnsZone"), Elem: &schema.Resource{ - Schema: schemaMapOfComputer(scalar_field_name), + Schema: schemaMapOfDnsZone(scalar_field_name), }, } } -func schemaMapOfComputer(scalar_field_name string) map[string]*schema.Schema { +func schemaMapOfDnsZone(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "operating_system": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "description": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "dns_name": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "path": { + "zone_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "created": { + "zone_type": { Type: schema.TypeString, Computed: true, Description: "", }, - "sid": { + "type": { Type: schema.TypeString, Computed: true, Description: "", }, - "computer_name": { + "distinguished_name": { Type: schema.TypeString, Computed: true, Description: "", @@ -106,89 +88,89 @@ func schemaMapOfComputer(scalar_field_name string) map[string]*schema.Schema { } } -func schemaOfDnsZoneList(scalar_field_name string) *schema.Schema { +func schemaOfOUList(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", "OU"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsZone(scalar_field_name), + Schema: schemaMapOfOU(scalar_field_name), }, } } -func schemaOfDnsZone(scalar_field_name string) *schema.Schema { +func schemaOfOU(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", "OU"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsZone(scalar_field_name), + Schema: schemaMapOfOU(scalar_field_name), }, } } -func schemaMapOfDnsZone(scalar_field_name string) map[string]*schema.Schema { +func schemaMapOfOU(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "distinguished_name": { + "guid": { Type: schema.TypeString, Computed: true, Description: "", }, - "zone_name": { + "name": { Type: schema.TypeString, Computed: true, Description: "", }, - "zone_type": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "type": { + "path": { Type: schema.TypeString, Computed: true, Description: "", }, + + "protected": { + Type: schema.TypeBool, + Computed: true, + Description: "", + }, } } -func schemaOfGroupList(scalar_field_name string) *schema.Schema { +func schemaOfDnsRecordList(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("List of %s", "Group"), + Description: fmt.Sprintf("List of %s", "DnsRecord"), Elem: &schema.Resource{ - Schema: schemaMapOfGroup(scalar_field_name), + Schema: schemaMapOfDnsRecord(scalar_field_name), }, } } -func schemaOfGroup(scalar_field_name string) *schema.Schema { +func schemaOfDnsRecord(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "Group"), + Description: fmt.Sprintf("Single Element List of %s", "DnsRecord"), Elem: &schema.Resource{ - Schema: schemaMapOfGroup(scalar_field_name), + Schema: schemaMapOfDnsRecord(scalar_field_name), }, } } -func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { +func schemaMapOfDnsRecord(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "email": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "ou_path": { + "name": { Type: schema.TypeString, Computed: true, Description: "", @@ -200,25 +182,19 @@ func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { Description: "", }, - "guid": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "name": { + "data": { Type: schema.TypeString, Computed: true, Description: "", }, - "scope": { + "zone": { Type: schema.TypeString, Computed: true, Description: "", }, - "description": { + "timestamp": { Type: schema.TypeString, Computed: true, Description: "", @@ -226,158 +202,128 @@ func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { } } -func schemaOfOUList(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", "OU"), + Description: fmt.Sprintf("List of %s", "User"), Elem: &schema.Resource{ - Schema: schemaMapOfOU(scalar_field_name), + Schema: schemaMapOfUser(scalar_field_name), }, } } -func schemaOfOU(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", "OU"), + Description: fmt.Sprintf("Single Element List of %s", "User"), Elem: &schema.Resource{ - Schema: schemaMapOfOU(scalar_field_name), + Schema: schemaMapOfUser(scalar_field_name), }, } } -func schemaMapOfOU(scalar_field_name string) map[string]*schema.Schema { +func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "name": { + "ou_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "description": { + "job_title": { Type: schema.TypeString, Computed: true, Description: "", }, - "path": { + "mobile_phone": { Type: schema.TypeString, Computed: true, Description: "", }, - "protected": { + "rds_allow_logon": { Type: schema.TypeBool, Computed: true, Description: "", }, - "guid": { + "profile_path": { 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), + "home_folder_path": { + Type: schema.TypeString, + Computed: true, + Description: "", }, - } -} -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), + "department": { + Type: schema.TypeString, + Computed: true, + Description: "", }, - } -} - -func schemaMapOfDnsRecord(scalar_field_name string) map[string]*schema.Schema { - return map[string]*schema.Schema{ - "data": { - Type: schema.TypeString, + "change_password_next_logon": { + Type: schema.TypeBool, Computed: true, Description: "", }, - "zone": { + "street_address": { Type: schema.TypeString, Computed: true, Description: "", }, - "timestamp": { + "street_po_box": { Type: schema.TypeString, Computed: true, Description: "", }, - "name": { + "display_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "type": { + "company": { 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), + "sam_username": { + Type: schema.TypeString, + Computed: true, + Description: "", }, - } -} -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), + "office_phone": { + Type: schema.TypeString, + Computed: true, + Description: "", }, - } -} -func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { - return map[string]*schema.Schema{ - - "state": { - Type: schema.TypeString, + "rds_connect_drive": { + Type: schema.TypeBool, Computed: true, Description: "", }, - "country": { + "home_phone": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_folder_path": { + "profile_logon_script": { Type: schema.TypeString, Computed: true, Description: "", @@ -389,187 +335,241 @@ func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { Description: "", }, - "sam_username": { + "rds_profile_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "street_po_box": { + "username": { Type: schema.TypeString, Computed: true, Description: "", }, - "initials": { + "middle_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "office_phone": { + "office": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_allow_logon": { - Type: schema.TypeBool, + "postal_code": { + Type: schema.TypeString, Computed: true, Description: "", }, - "username": { + "home_folder_drive": { Type: schema.TypeString, Computed: true, Description: "", }, - "first_name": { + "rds_home_folder_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "mobile_phone": { + "rds_home_folder_drive": { Type: schema.TypeString, Computed: true, Description: "", }, - "company": { + "last_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "last_name": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "office": { + "state": { Type: schema.TypeString, Computed: true, Description: "", }, - "job_title": { + "country": { Type: schema.TypeString, Computed: true, Description: "", }, - "postal_code": { + "first_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_phone": { + "email_address": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_folder_drive": { + "initials": { Type: schema.TypeString, Computed: true, Description: "", }, - "display_name": { + "manager": { Type: schema.TypeString, Computed: true, Description: "", }, - "department": { + "city": { Type: schema.TypeString, Computed: true, Description: "", }, + } +} - "email_address": { +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{ + + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "change_password_next_logon": { - Type: schema.TypeBool, + "email": { + Type: schema.TypeString, Computed: true, Description: "", }, - "rds_home_folder_drive": { + "ou_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "middle_name": { + "type": { Type: schema.TypeString, Computed: true, Description: "", }, - "description": { + "guid": { Type: schema.TypeString, Computed: true, Description: "", }, - "profile_path": { + "name": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_profile_path": { + "scope": { Type: schema.TypeString, 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), + }, + } +} - "rds_connect_drive": { - Type: schema.TypeBool, +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{ + + "sid": { + Type: schema.TypeString, Computed: true, Description: "", }, - "manager": { + "computer_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "city": { + "operating_system": { Type: schema.TypeString, Computed: true, Description: "", }, - "profile_logon_script": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_home_folder_path": { + "dns_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "ou_path": { + "path": { Type: schema.TypeString, Computed: true, Description: "", }, - "street_address": { + "created": { Type: schema.TypeString, Computed: true, Description: "", diff --git a/provider/kopicloud.user-crud.gen.go b/provider/kopicloud.user-crud.gen.go index ad76377..db2f8f2 100644 --- a/provider/kopicloud.user-crud.gen.go +++ b/provider/kopicloud.user-crud.gen.go @@ -120,8 +120,8 @@ func resourceUser() *schema.Resource { terraformSchema["new_password"] = &schema.Schema{ Type: schema.TypeString, Computed: false, - Optional: false, - Required: true, + Optional: true, + Required: false, Description: "", }