From 467d6096c1f4dd335f1f4a48adcd75279b349ea3 Mon Sep 17 00:00:00 2001 From: Oscar Forero Date: Sat, 18 Mar 2023 21:03:03 +0100 Subject: [PATCH] Add kopicloud_user_password_reset element --- .../kopicloud_user_password_reset.md | 74 +++++ generator-inputs/user_password_reset.json | 108 +++++++ main.go | 5 +- provider/kopicloud.converters.gen.go | 272 +++++++++--------- provider/kopicloud.resources-schemas.gen.go | 2 + provider/kopicloud.schemas.gen.go | 252 ++++++++-------- 6 files changed, 450 insertions(+), 263 deletions(-) create mode 100644 docs/resources/kopicloud_user_password_reset.md create mode 100644 generator-inputs/user_password_reset.json diff --git a/docs/resources/kopicloud_user_password_reset.md b/docs/resources/kopicloud_user_password_reset.md new file mode 100644 index 0000000..7a9dae5 --- /dev/null +++ b/docs/resources/kopicloud_user_password_reset.md @@ -0,0 +1,74 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "kopicloud_user_password_reset Resource - kopicloud-ad-tf-provider" +subcategory: "" +description: |- + Element to create, update, delete Users from Active Directory +--- + +# kopicloud_user_password_reset (Resource) + +Element to create, update, delete Users from Active Directory + + + + +## Schema + +### Required + +- `new_password` (String) +- `username` (String) + +### Optional + +- `change_password_net_logon` (Boolean) +- `show_fields` (String) + +### Read-Only + +- `id` (String) The ID of this resource. +- `result` (List of Object) Single Element List of User (see [below for nested schema](#nestedatt--result)) + + +### Nested Schema for `result` + +Read-Only: + +- `change_password_next_logon` (Boolean) +- `city` (String) +- `company` (String) +- `country` (String) +- `department` (String) +- `description` (String) +- `display_name` (String) +- `email_address` (String) +- `first_name` (String) +- `home_folder_directory` (String) +- `home_folder_drive` (String) +- `home_folder_path` (String) +- `home_phone` (String) +- `initials` (String) +- `job_title` (String) +- `last_name` (String) +- `manager` (String) +- `middle_name` (String) +- `mobile_phone` (String) +- `office` (String) +- `office_phone` (String) +- `ou_path` (String) +- `postal_code` (String) +- `profile_logon_script` (String) +- `profile_path` (String) +- `rds_allow_logon` (Boolean) +- `rds_connect_drive` (Boolean) +- `rds_home_folder_drive` (String) +- `rds_home_folder_path` (String) +- `rds_profile_path` (String) +- `sam_username` (String) +- `state` (String) +- `street_address` (String) +- `street_po_box` (String) +- `username` (String) + + diff --git a/generator-inputs/user_password_reset.json b/generator-inputs/user_password_reset.json new file mode 100644 index 0000000..541ffe0 --- /dev/null +++ b/generator-inputs/user_password_reset.json @@ -0,0 +1,108 @@ +{ + "api_alias": "kcapi", + "api_package": "github.com/KopiCloud-AD-API/terraform-provider-ad/api", + "package": "provider", + "data_sources" : [], + "resources" : [ + { + "name": "UserPasswordReset", + "description" : "Element to create, update, delete Users from Active Directory", + "terraform": { + "name": "kopicloud_user_password_reset", + "arguments": [ + { + "name": "username", + "type": "schema.TypeString", + "required": true + }, + { + "name": "new_password", + "type": "schema.TypeString", + "required": true + }, + { + "name": "change_password_net_logon", + "type": "schema.TypeBool", + "optional": true + }, + { + "name": "show_fields", + "type": "schema.TypeString", + "optional": true + } + ] + }, + "result_schemas": { + "result": { + "schema_function": "schemaOfUser", + "schema_function_arguments": "(``)" + } + }, + + "element_name": "UserPasswordReset", + "create": { + "api_function": { + "name": "PostApiADUserUsernameResetPasswordWithResponse", + "isPointer": true, + "arguments": [ + { + "name": "username", + "type": "string" + } + ], + "params": { + "name": "PostApiADUserUsernameResetPasswordParams", + "fields": [ + { + "api_name": "NewPassword", + "name": "new_password", + "type": "*string" + }, + { + "api_name": "ChangePassword", + "name": "change_password_net_logon", + "type": "*bool" + }, + { + "api_name": "ShowFields", + "name": "show_fields", + "type": "*string" + } + ] + } + }, + "result": { + "msg_field": "Output", + "result_field": "Result", + "api_to_terraform": "UserToTerraform", + "result_wrapper": "wrapInArray", + "terraform_field": "result", + "api_to_terraform_id": "getId_for_User" + } + }, + "read": { + "api_function": { + "name": "GetApiADUserUsernameWithResponse", + "arguments": [ + { + "name": "username", + "type": "string" + } + ], + "params": { + "name": "GetApiADUserUsernameParams", + "fields": [] + } + }, + "result": { + "msg_field": "Output", + "result_field": "Result", + "api_to_terraform": "UserToTerraform", + "result_wrapper": "wrapInArray", + "terraform_field": "result", + "api_to_terraform_id": "getId_for_User" + } + } + } + ] +} \ No newline at end of file diff --git a/main.go b/main.go index 3a607fa..dfa0c89 100644 --- a/main.go +++ b/main.go @@ -54,6 +54,9 @@ import ( //go:generate openapi-terraform-provider-generator resource-update --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.user-update.gen.go -i generator-inputs/user.json //go:generate openapi-terraform-provider-generator datasource-read --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.user-data.gen.go -i generator-inputs/user.json +// Generate the Code for User Password Reset +//go:generate openapi-terraform-provider-generator resource-crud --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.user-password-reset-crud.gen.go -i generator-inputs/user_password_reset.json + // Generate the Code for the DNS A Records //go:generate openapi-terraform-provider-generator resource-crud --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.dns_a_record-crud.gen.go -i generator-inputs/dns_a_record.json //go:generate openapi-terraform-provider-generator datasource-read --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.dns_a_record-data.gen.go -i generator-inputs/dns_a_record.json @@ -75,7 +78,7 @@ import ( //go:generate openapi-terraform-provider-generator datasource-read --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.dns_reverse_lookup_zone-data.gen.go -i generator-inputs/dns_reverse_lookup_zone.json // Generate the schemas for the resources (should list all the JSON files for which resources were generated) -//go:generate openapi-terraform-provider-generator resource-schemas --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.resources-schemas.gen.go -i generator-inputs/computer.json -i generator-inputs/computer_cleanup.json -i generator-inputs/organizational_unit.json -i generator-inputs/dns_a_record.json -i generator-inputs/dns_aaaa_record.json -i generator-inputs/dns_cname_record.json -i generator-inputs/dns_lookup_zone.json -i generator-inputs/dns_reverse_lookup_zone.json -i generator-inputs/security_group.json -i generator-inputs/distribution_group.json -i generator-inputs/group_membership.json -i generator-inputs/user.json +//go:generate openapi-terraform-provider-generator resource-schemas --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.resources-schemas.gen.go -i generator-inputs/computer.json -i generator-inputs/computer_cleanup.json -i generator-inputs/organizational_unit.json -i generator-inputs/dns_a_record.json -i generator-inputs/dns_aaaa_record.json -i generator-inputs/dns_cname_record.json -i generator-inputs/dns_lookup_zone.json -i generator-inputs/dns_reverse_lookup_zone.json -i generator-inputs/security_group.json -i generator-inputs/distribution_group.json -i generator-inputs/group_membership.json -i generator-inputs/user.json -i generator-inputs/user_password_reset.json // Generate the code for the datasources (Schemas) //go:generate openapi-terraform-provider-generator datasource-schemas --api github.com/KopiCloud-AD-API/terraform-provider-ad/api -p provider -o provider/kopicloud.datasources-schemas.gen.go -i generator-inputs/computer.json -i generator-inputs/organizational_unit.json -i generator-inputs/dns_a_record.json -i generator-inputs/dns_aaaa_record.json -i generator-inputs/dns_cname_record.json -i generator-inputs/dns_lookup_zone.json -i generator-inputs/dns_reverse_lookup_zone.json -i generator-inputs/security_group.json -i generator-inputs/distribution_group.json -i generator-inputs/group_membership.json -i generator-inputs/user.json diff --git a/provider/kopicloud.converters.gen.go b/provider/kopicloud.converters.gen.go index d82404c..6e4430e 100644 --- a/provider/kopicloud.converters.gen.go +++ b/provider/kopicloud.converters.gen.go @@ -34,119 +34,130 @@ func isNotEmpty(f interface{}) bool { } } -func OUToTerraform(obj *api.OU) map[string]interface{} { +func DnsRecordToTerraform(obj *api.DnsRecord) map[string]interface{} { result := make(map[string]interface{}) - if obj.Path != nil && isNotEmpty(obj.Path) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["path"] = obj.Path + result["type"] = obj.Type } - if obj.Protected != nil && isNotEmpty(obj.Protected) { + if obj.Data != nil && isNotEmpty(obj.Data) { - result["protected"] = obj.Protected + result["data"] = obj.Data } - if obj.Guid != nil && isNotEmpty(obj.Guid) { + if obj.Zone != nil && isNotEmpty(obj.Zone) { - result["guid"] = UuidToTerraform(obj.Guid) + result["zone"] = obj.Zone } - if obj.Name != nil && isNotEmpty(obj.Name) { + if obj.Timestamp != nil && isNotEmpty(obj.Timestamp) { - result["name"] = obj.Name + result["timestamp"] = obj.Timestamp } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.Name != nil && isNotEmpty(obj.Name) { - result["description"] = obj.Description + result["name"] = obj.Name } 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 UserToTerraform(obj *api.User) map[string]interface{} { +func GroupToTerraform(obj *api.Group) map[string]interface{} { result := make(map[string]interface{}) - if obj.LastName != nil && isNotEmpty(obj.LastName) { + if obj.Scope != nil && isNotEmpty(obj.Scope) { - result["last_name"] = obj.LastName + result["scope"] = obj.Scope } - if obj.Office != nil && isNotEmpty(obj.Office) { + if obj.Description != nil && isNotEmpty(obj.Description) { - result["office"] = obj.Office + result["description"] = obj.Description } - if obj.Initials != nil && isNotEmpty(obj.Initials) { + if obj.Email != nil && isNotEmpty(obj.Email) { - result["initials"] = obj.Initials + result["email"] = obj.Email } - if obj.ChangePasswordNextLogon != nil && isNotEmpty(obj.ChangePasswordNextLogon) { + if obj.OuPath != nil && isNotEmpty(obj.OuPath) { - result["change_password_next_logon"] = obj.ChangePasswordNextLogon + result["ou_path"] = obj.OuPath } - if obj.OuPath != nil && isNotEmpty(obj.OuPath) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["ou_path"] = obj.OuPath + result["type"] = obj.Type } - if obj.City != nil && isNotEmpty(obj.City) { + if obj.Guid != nil && isNotEmpty(obj.Guid) { - result["city"] = obj.City + result["guid"] = UuidToTerraform(obj.Guid) } - if obj.Country != nil && isNotEmpty(obj.Country) { + if obj.Name != nil && isNotEmpty(obj.Name) { - result["country"] = obj.Country + result["name"] = obj.Name } - if obj.HomeFolderPath != nil && isNotEmpty(obj.HomeFolderPath) { - - result["home_folder_path"] = obj.HomeFolderPath + return result +} +func GroupListToTerraform(list *[]api.Group) []interface{} { + if list != nil { + results := make([]interface{}, len(*list)) + for i, Group := range *list { + results[i] = GroupToTerraform(&Group) + } + return results } + return make([]interface{}, 0) +} - if obj.StreetPoBox != nil && isNotEmpty(obj.StreetPoBox) { +func UserToTerraform(obj *api.User) map[string]interface{} { + result := make(map[string]interface{}) - result["street_po_box"] = obj.StreetPoBox + if obj.LastName != nil && isNotEmpty(obj.LastName) { + + result["last_name"] = obj.LastName } - if obj.MobilePhone != nil && isNotEmpty(obj.MobilePhone) { + if obj.DisplayName != nil && isNotEmpty(obj.DisplayName) { - result["mobile_phone"] = obj.MobilePhone + result["display_name"] = obj.DisplayName } - if obj.JobTitle != nil && isNotEmpty(obj.JobTitle) { + if obj.Office != nil && isNotEmpty(obj.Office) { - result["job_title"] = obj.JobTitle + result["office"] = obj.Office } @@ -156,39 +167,39 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - 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.ProfilePath != nil && isNotEmpty(obj.ProfilePath) { + if obj.FirstName != nil && isNotEmpty(obj.FirstName) { - result["profile_path"] = obj.ProfilePath + result["first_name"] = obj.FirstName } - if obj.RdsProfilePath != nil && isNotEmpty(obj.RdsProfilePath) { + if obj.SamUsername != nil && isNotEmpty(obj.SamUsername) { - result["rds_profile_path"] = obj.RdsProfilePath + result["sam_username"] = obj.SamUsername } - if obj.FirstName != nil && isNotEmpty(obj.FirstName) { + if obj.Initials != nil && isNotEmpty(obj.Initials) { - result["first_name"] = obj.FirstName + result["initials"] = obj.Initials } - if obj.SamUsername != nil && isNotEmpty(obj.SamUsername) { + if obj.Country != nil && isNotEmpty(obj.Country) { - result["sam_username"] = obj.SamUsername + result["country"] = obj.Country } - if obj.PostalCode != nil && isNotEmpty(obj.PostalCode) { + if obj.MobilePhone != nil && isNotEmpty(obj.MobilePhone) { - result["postal_code"] = obj.PostalCode + result["mobile_phone"] = obj.MobilePhone } @@ -198,21 +209,21 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.MiddleName != nil && isNotEmpty(obj.MiddleName) { + if obj.Username != nil && isNotEmpty(obj.Username) { - result["middle_name"] = obj.MiddleName + result["username"] = obj.Username } - if obj.DisplayName != nil && isNotEmpty(obj.DisplayName) { + if obj.City != nil && isNotEmpty(obj.City) { - result["display_name"] = obj.DisplayName + result["city"] = obj.City } - if obj.Description != nil && isNotEmpty(obj.Description) { + if obj.ProfilePath != nil && isNotEmpty(obj.ProfilePath) { - result["description"] = obj.Description + result["profile_path"] = obj.ProfilePath } @@ -222,27 +233,27 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.StreetAddress != nil && isNotEmpty(obj.StreetAddress) { + if obj.State != nil && isNotEmpty(obj.State) { - result["street_address"] = obj.StreetAddress + result["state"] = obj.State } - if obj.RdsAllowLogon != nil && isNotEmpty(obj.RdsAllowLogon) { + if obj.OfficePhone != nil && isNotEmpty(obj.OfficePhone) { - result["rds_allow_logon"] = obj.RdsAllowLogon + result["office_phone"] = obj.OfficePhone } - if obj.Username != nil && isNotEmpty(obj.Username) { + if obj.HomeFolderPath != nil && isNotEmpty(obj.HomeFolderPath) { - result["username"] = obj.Username + result["home_folder_path"] = obj.HomeFolderPath } - if obj.Department != nil && isNotEmpty(obj.Department) { + if obj.MiddleName != nil && isNotEmpty(obj.MiddleName) { - result["department"] = obj.Department + result["middle_name"] = obj.MiddleName } @@ -252,21 +263,21 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.OfficePhone != nil && isNotEmpty(obj.OfficePhone) { + if obj.OuPath != nil && isNotEmpty(obj.OuPath) { - result["office_phone"] = obj.OfficePhone + result["ou_path"] = obj.OuPath } - if obj.RdsConnectDrive != nil && isNotEmpty(obj.RdsConnectDrive) { + if obj.ChangePasswordNextLogon != nil && isNotEmpty(obj.ChangePasswordNextLogon) { - result["rds_connect_drive"] = obj.RdsConnectDrive + result["change_password_next_logon"] = obj.ChangePasswordNextLogon } - if obj.HomePhone != nil && isNotEmpty(obj.HomePhone) { + if obj.JobTitle != nil && isNotEmpty(obj.JobTitle) { - result["home_phone"] = obj.HomePhone + result["job_title"] = obj.JobTitle } @@ -276,79 +287,80 @@ func UserToTerraform(obj *api.User) map[string]interface{} { } - if obj.HomeFolderDirectory != nil && isNotEmpty(obj.HomeFolderDirectory) { + if obj.RdsConnectDrive != nil && isNotEmpty(obj.RdsConnectDrive) { - result["home_folder_directory"] = obj.HomeFolderDirectory + result["rds_connect_drive"] = obj.RdsConnectDrive } - if obj.RdsHomeFolderPath != nil && isNotEmpty(obj.RdsHomeFolderPath) { + if obj.Description != nil && isNotEmpty(obj.Description) { - result["rds_home_folder_path"] = obj.RdsHomeFolderPath + result["description"] = obj.Description } - if obj.RdsHomeFolderDrive != nil && isNotEmpty(obj.RdsHomeFolderDrive) { + if obj.Department != nil && isNotEmpty(obj.Department) { - result["rds_home_folder_drive"] = obj.RdsHomeFolderDrive + result["department"] = obj.Department } - return result -} + if obj.StreetAddress != nil && isNotEmpty(obj.StreetAddress) { + + result["street_address"] = obj.StreetAddress -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) -} -func DnsRecordToTerraform(obj *api.DnsRecord) map[string]interface{} { - result := make(map[string]interface{}) + if obj.StreetPoBox != nil && isNotEmpty(obj.StreetPoBox) { - if obj.Type != nil && isNotEmpty(obj.Type) { + result["street_po_box"] = obj.StreetPoBox - result["type"] = obj.Type + } + + if obj.HomePhone != nil && isNotEmpty(obj.HomePhone) { + + result["home_phone"] = obj.HomePhone } - if obj.Data != nil && isNotEmpty(obj.Data) { + if obj.RdsHomeFolderPath != nil && isNotEmpty(obj.RdsHomeFolderPath) { - result["data"] = obj.Data + result["rds_home_folder_path"] = obj.RdsHomeFolderPath } - if obj.Zone != nil && isNotEmpty(obj.Zone) { + if obj.RdsHomeFolderDrive != nil && isNotEmpty(obj.RdsHomeFolderDrive) { - result["zone"] = obj.Zone + result["rds_home_folder_drive"] = obj.RdsHomeFolderDrive } - if obj.Timestamp != nil && isNotEmpty(obj.Timestamp) { + if obj.HomeFolderDirectory != nil && isNotEmpty(obj.HomeFolderDirectory) { - result["timestamp"] = obj.Timestamp + result["home_folder_directory"] = obj.HomeFolderDirectory } - if obj.Name != nil && isNotEmpty(obj.Name) { + if obj.RdsProfilePath != nil && isNotEmpty(obj.RdsProfilePath) { - result["name"] = obj.Name + result["rds_profile_path"] = obj.RdsProfilePath + + } + + if obj.RdsAllowLogon != nil && isNotEmpty(obj.RdsAllowLogon) { + + result["rds_allow_logon"] = obj.RdsAllowLogon } return result } -func DnsRecordListToTerraform(list *[]api.DnsRecord) []interface{} { +func UserListToTerraform(list *[]api.User) []interface{} { if list != nil { results := make([]interface{}, len(*list)) - for i, DnsRecord := range *list { - results[i] = DnsRecordToTerraform(&DnsRecord) + for i, User := range *list { + results[i] = UserToTerraform(&User) } return results } @@ -358,27 +370,27 @@ func DnsRecordListToTerraform(list *[]api.DnsRecord) []interface{} { func DnsZoneToTerraform(obj *api.DnsZone) map[string]interface{} { result := make(map[string]interface{}) - if obj.DistinguishedName != nil && isNotEmpty(obj.DistinguishedName) { + if obj.ZoneType != nil && isNotEmpty(obj.ZoneType) { - result["distinguished_name"] = obj.DistinguishedName + result["zone_type"] = obj.ZoneType } - if obj.ZoneName != nil && isNotEmpty(obj.ZoneName) { + if obj.Type != nil && isNotEmpty(obj.Type) { - result["zone_name"] = obj.ZoneName + result["type"] = obj.Type } - if obj.ZoneType != nil && isNotEmpty(obj.ZoneType) { + if obj.DistinguishedName != nil && isNotEmpty(obj.DistinguishedName) { - result["zone_type"] = obj.ZoneType + result["distinguished_name"] = obj.DistinguishedName } - if obj.Type != nil && isNotEmpty(obj.Type) { + if obj.ZoneName != nil && isNotEmpty(obj.ZoneName) { - result["type"] = obj.Type + result["zone_name"] = obj.ZoneName } @@ -396,59 +408,47 @@ func DnsZoneListToTerraform(list *[]api.DnsZone) []interface{} { 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.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.Guid != nil && isNotEmpty(obj.Guid) { - result["ou_path"] = obj.OuPath + result["guid"] = UuidToTerraform(obj.Guid) } - if obj.Type != nil && isNotEmpty(obj.Type) { + if obj.Name != nil && isNotEmpty(obj.Name) { - result["type"] = obj.Type + result["name"] = obj.Name } - 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.Path != nil && isNotEmpty(obj.Path) { - result["name"] = obj.Name + result["path"] = obj.Path } - if obj.Scope != nil && isNotEmpty(obj.Scope) { + if obj.Protected != nil && isNotEmpty(obj.Protected) { - result["scope"] = obj.Scope + result["protected"] = obj.Protected } 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 } diff --git a/provider/kopicloud.resources-schemas.gen.go b/provider/kopicloud.resources-schemas.gen.go index bc81e4d..84eacc3 100644 --- a/provider/kopicloud.resources-schemas.gen.go +++ b/provider/kopicloud.resources-schemas.gen.go @@ -43,5 +43,7 @@ func resources() map[string]*schema.Resource { "kopicloud_group_membership": resourceGroupMembership(), "kopicloud_user": resourceUser(), + + "kopicloud_user_password_reset": resourceUserPasswordReset(), } } diff --git a/provider/kopicloud.schemas.gen.go b/provider/kopicloud.schemas.gen.go index 1ccbcb4..302767d 100644 --- a/provider/kopicloud.schemas.gen.go +++ b/provider/kopicloud.schemas.gen.go @@ -37,29 +37,29 @@ func schemaMapOfScalarElement(t schema.ValueType, field_name string) map[string] } } -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{ "name": { @@ -68,37 +68,25 @@ func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { Description: "", }, - "scope": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "description": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "email": { + "type": { Type: schema.TypeString, Computed: true, Description: "", }, - "ou_path": { + "data": { Type: schema.TypeString, Computed: true, Description: "", }, - "type": { + "zone": { Type: schema.TypeString, Computed: true, Description: "", }, - "guid": { + "timestamp": { Type: schema.TypeString, Computed: true, Description: "", @@ -106,32 +94,32 @@ func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { } } -func schemaOfDnsRecordList(scalar_field_name string) *schema.Schema { +func schemaOfGroupList(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", "Group"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsRecord(scalar_field_name), + Schema: schemaMapOfGroup(scalar_field_name), }, } } -func schemaOfDnsRecord(scalar_field_name string) *schema.Schema { +func schemaOfGroup(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", "Group"), Elem: &schema.Resource{ - Schema: schemaMapOfDnsRecord(scalar_field_name), + Schema: schemaMapOfGroup(scalar_field_name), }, } } -func schemaMapOfDnsRecord(scalar_field_name string) map[string]*schema.Schema { +func schemaMapOfGroup(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "name": { + "ou_path": { Type: schema.TypeString, Computed: true, Description: "", @@ -143,50 +131,11 @@ func schemaMapOfDnsRecord(scalar_field_name string) map[string]*schema.Schema { Description: "", }, - "data": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "zone": { - Type: schema.TypeString, - Computed: true, - Description: "", - }, - - "timestamp": { + "guid": { Type: schema.TypeString, Computed: true, Description: "", }, - } -} - -func schemaOfOUList(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("List of %s", "OU"), - Elem: &schema.Resource{ - Schema: schemaMapOfOU(scalar_field_name), - }, - } -} - -func schemaOfOU(scalar_field_name string) *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: fmt.Sprintf("Single Element List of %s", "OU"), - Elem: &schema.Resource{ - Schema: schemaMapOfOU(scalar_field_name), - }, - } -} - -func schemaMapOfOU(scalar_field_name string) map[string]*schema.Schema { - return map[string]*schema.Schema{ "name": { Type: schema.TypeString, @@ -194,25 +143,19 @@ func schemaMapOfOU(scalar_field_name string) map[string]*schema.Schema { Description: "", }, - "description": { + "scope": { Type: schema.TypeString, Computed: true, Description: "", }, - "path": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "protected": { - Type: schema.TypeBool, - Computed: true, - Description: "", - }, - - "guid": { + "email": { Type: schema.TypeString, Computed: true, Description: "", @@ -245,43 +188,43 @@ func schemaOfComputer(scalar_field_name string) *schema.Schema { func schemaMapOfComputer(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "computer_name": { + "created": { Type: schema.TypeString, Computed: true, Description: "", }, - "operating_system": { + "sid": { Type: schema.TypeString, Computed: true, Description: "", }, - "description": { + "computer_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "dns_name": { + "operating_system": { Type: schema.TypeString, Computed: true, Description: "", }, - "path": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "created": { + "dns_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "sid": { + "path": { Type: schema.TypeString, Computed: true, Description: "", @@ -340,6 +283,63 @@ func schemaMapOfDnsZone(scalar_field_name string) map[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", "OU"), + Elem: &schema.Resource{ + Schema: schemaMapOfOU(scalar_field_name), + }, + } +} + +func schemaOfOU(scalar_field_name string) *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: fmt.Sprintf("Single Element List of %s", "OU"), + Elem: &schema.Resource{ + Schema: schemaMapOfOU(scalar_field_name), + }, + } +} + +func schemaMapOfOU(scalar_field_name string) map[string]*schema.Schema { + return map[string]*schema.Schema{ + + "name": { + Type: schema.TypeString, + Computed: true, + Description: "", + }, + + "description": { + Type: schema.TypeString, + Computed: true, + Description: "", + }, + + "path": { + Type: schema.TypeString, + Computed: true, + Description: "", + }, + + "protected": { + Type: schema.TypeBool, + Computed: true, + Description: "", + }, + + "guid": { + Type: schema.TypeString, + Computed: true, + Description: "", + }, + } +} + func schemaOfUserList(scalar_field_name string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, @@ -365,49 +365,49 @@ func schemaOfUser(scalar_field_name string) *schema.Schema { func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { return map[string]*schema.Schema{ - "ou_path": { + "profile_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_connect_drive": { - Type: schema.TypeBool, + "home_folder_directory": { + Type: schema.TypeString, Computed: true, Description: "", }, - "description": { + "last_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "street_address": { + "job_title": { Type: schema.TypeString, Computed: true, Description: "", }, - "state": { + "mobile_phone": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_home_folder_drive": { + "manager": { Type: schema.TypeString, Computed: true, Description: "", }, - "profile_logon_script": { + "state": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_folder_drive": { + "middle_name": { Type: schema.TypeString, Computed: true, Description: "", @@ -419,55 +419,55 @@ func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { Description: "", }, - "initials": { + "office": { Type: schema.TypeString, Computed: true, Description: "", }, - "country": { + "first_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "mobile_phone": { + "display_name": { Type: schema.TypeString, Computed: true, Description: "", }, - "department": { + "country": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_folder_directory": { + "department": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_allow_logon": { - Type: schema.TypeBool, + "office_phone": { + Type: schema.TypeString, Computed: true, Description: "", }, - "home_phone": { + "home_folder_drive": { Type: schema.TypeString, Computed: true, Description: "", }, - "home_folder_path": { + "street_address": { Type: schema.TypeString, Computed: true, Description: "", }, - "rds_profile_path": { + "postal_code": { Type: schema.TypeString, Computed: true, Description: "", @@ -479,97 +479,97 @@ func schemaMapOfUser(scalar_field_name string) map[string]*schema.Schema { Description: "", }, - "company": { + "description": { Type: schema.TypeString, Computed: true, Description: "", }, - "change_password_next_logon": { - Type: schema.TypeBool, + "sam_username": { + Type: schema.TypeString, Computed: true, Description: "", }, - "postal_code": { + "ou_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "office_phone": { + "initials": { Type: schema.TypeString, Computed: true, Description: "", }, - "username": { + "home_phone": { Type: schema.TypeString, Computed: true, Description: "", }, - "first_name": { + "street_po_box": { Type: schema.TypeString, Computed: true, Description: "", }, - "job_title": { + "profile_logon_script": { Type: schema.TypeString, Computed: true, Description: "", }, - "profile_path": { + "rds_profile_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "middle_name": { + "username": { Type: schema.TypeString, Computed: true, Description: "", }, - "display_name": { + "company": { Type: schema.TypeString, Computed: true, Description: "", }, - "office": { - Type: schema.TypeString, + "change_password_next_logon": { + Type: schema.TypeBool, Computed: true, Description: "", }, - "manager": { - Type: schema.TypeString, + "rds_connect_drive": { + Type: schema.TypeBool, Computed: true, Description: "", }, - "last_name": { - Type: schema.TypeString, + "rds_allow_logon": { + Type: schema.TypeBool, Computed: true, Description: "", }, - "sam_username": { + "city": { Type: schema.TypeString, Computed: true, Description: "", }, - "street_po_box": { + "home_folder_path": { Type: schema.TypeString, Computed: true, Description: "", }, - "city": { + "rds_home_folder_drive": { Type: schema.TypeString, Computed: true, Description: "",