diff --git a/CHANGELOG.md b/CHANGELOG.md index 7386b9c..f357710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.3 (unreleased) + +- Add resource `network_access_authentication_rule_update_rank` for updating rank under network access authentication rule to bypass API limitation which restricts rank assignments to a strictly incremental sequence + ## 0.2.2 - Fix issue with `ise_repository` triggers in-place upgrade when no changes are made #59 diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index e5174ad..048df6e 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.2.3 (unreleased) + +- Add resource `network_access_authentication_rule_update_rank` for updating rank under network access authentication rule to bypass API limitation which restricts rank assignments to a strictly incremental sequence + ## 0.2.2 - Fix issue with `ise_repository` triggers in-place upgrade when no changes are made #59 diff --git a/docs/resources/network_access_authentication_rule_update_rank.md b/docs/resources/network_access_authentication_rule_update_rank.md new file mode 100644 index 0000000..d01df1b --- /dev/null +++ b/docs/resources/network_access_authentication_rule_update_rank.md @@ -0,0 +1,34 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ise_network_access_authentication_rule_update_rank Resource - terraform-provider-ise" +subcategory: "Network Access" +description: |- + This resource is used to update rank field in network access authentication rule. It serves as a workaround for the ISE API/Backend limitation which restricts rank assignments to a strictly incremental sequence. By utilizing this resource and network_access_authentication_rule resource, you can bypass the APIs limitation. Creation of this resource is performing PUT operation (Update) and it only tracks rank field. When this resource is destroyed, no action is performed on ISE and resource is just removed from state. +--- + +# ise_network_access_authentication_rule_update_rank (Resource) + +This resource is used to update rank field in network access authentication rule. It serves as a workaround for the ISE API/Backend limitation which restricts rank assignments to a strictly incremental sequence. By utilizing this resource and network_access_authentication_rule resource, you can bypass the APIs limitation. Creation of this resource is performing PUT operation (Update) and it only tracks rank field. When this resource is destroyed, no action is performed on ISE and resource is just removed from state. + +## Example Usage + +```terraform +resource "ise_network_access_authentication_rule_update_rank" "example" { + auth_rule_id = "9b3680da-0165-44f6-9cff-88e778d98020" + policy_set_id = "d82952cb-b901-4b09-b363-5ebf39bdbaf9" + rank = 0 +} +``` + + +## Schema + +### Required + +- `auth_rule_id` (String) Authentication rule ID +- `policy_set_id` (String) Policy set ID +- `rank` (Number) The rank (priority) in relation to other rules. Lower rank is higher priority. + +### Read-Only + +- `id` (String) The id of the object diff --git a/examples/resources/ise_network_access_authentication_rule_update_rank/resource.tf b/examples/resources/ise_network_access_authentication_rule_update_rank/resource.tf new file mode 100644 index 0000000..c984172 --- /dev/null +++ b/examples/resources/ise_network_access_authentication_rule_update_rank/resource.tf @@ -0,0 +1,5 @@ +resource "ise_network_access_authentication_rule_update_rank" "example" { + auth_rule_id = "9b3680da-0165-44f6-9cff-88e778d98020" + policy_set_id = "d82952cb-b901-4b09-b363-5ebf39bdbaf9" + rank = 0 +} diff --git a/gen/definitions/network_access_authentication_rule.yaml b/gen/definitions/network_access_authentication_rule.yaml index 9eedeeb..0b56330 100644 --- a/gen/definitions/network_access_authentication_rule.yaml +++ b/gen/definitions/network_access_authentication_rule.yaml @@ -1,5 +1,6 @@ --- name: Network Access Authentication Rule +# Manual update in Update function in resource file to read rank from existing object and send that in PUT request rest_endpoint: /api/v1/policy/network-access/policy-set/%v/authentication data_source_name_query: true id_path: response.rule.id diff --git a/gen/definitions/network_access_authentication_rule_update_rank.yaml b/gen/definitions/network_access_authentication_rule_update_rank.yaml new file mode 100644 index 0000000..3d1dc18 --- /dev/null +++ b/gen/definitions/network_access_authentication_rule_update_rank.yaml @@ -0,0 +1,65 @@ +--- +name: Network Access Authentication Rule Update Rank +# Manual update in Create function in resource file to add AuthRuleId to path +# and populate attributes from existing resource using GET request in Create and Update functions +res_description: + 'This resource is used to update rank field in network access authentication rule. It serves as a workaround for the + ISE API/Backend limitation which restricts rank assignments to a strictly incremental sequence. + By utilizing this resource and network_access_authentication_rule resource, you can bypass the APIs limitation. + Creation of this resource is performing PUT operation (Update) and it only tracks rank field. + When this resource is destroyed, no action is performed on ISE and resource is just removed from state.' +rest_endpoint: /api/v1/policy/network-access/policy-set/%v/authentication +put_create: true +no_delete: true +no_import: true +no_data_source: true +skip_minimum_test: true +doc_category: Network Access +attributes: + - tf_name: auth_rule_id + type: String + write_only: true + mandatory: true + id: true + description: Authentication rule ID + example: 9b3680da-0165-44f6-9cff-88e778d98020 + test_value: ise_network_access_authentication_rule.test.id + - tf_name: policy_set_id + type: String + reference: true + description: Policy set ID + example: d82952cb-b901-4b09-b363-5ebf39bdbaf9 + test_value: ise_network_access_policy_set.test.id + - model_name: rank + mandatory: true + data_path: [rule] + type: Int64 + description: The rank (priority) in relation to other rules. Lower rank is higher priority. + example: 0 +test_prerequisites: | + resource "ise_network_access_policy_set" "test" { + name = "PolicySet1" + service_name = "Default Network Access" + condition_type = "ConditionAttributes" + condition_is_negate = false + condition_attribute_name = "Location" + condition_attribute_value = "All Locations" + condition_dictionary_name = "DEVICE" + condition_operator = "equals" + } + resource "ise_network_access_authentication_rule" "test" { + policy_set_id = ise_network_access_policy_set.test.id + name = "Rule1" + default = false + state = "enabled" + condition_type = "ConditionAttributes" + condition_is_negate = false + condition_attribute_name = "Location" + condition_attribute_value = "All Locations" + condition_dictionary_name = "DEVICE" + condition_operator = "equals" + identity_source_name = "Internal Endpoints" + if_auth_fail = "REJECT" + if_process_fail = "DROP" + if_user_not_found = "REJECT" + } \ No newline at end of file diff --git a/gen/templates/model.go b/gen/templates/model.go index 95bcc2b..c76c289 100644 --- a/gen/templates/model.go +++ b/gen/templates/model.go @@ -288,7 +288,7 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) {{- if and (not .Value) (not .WriteOnly) (not .Reference)}} {{- $cname := toGoName .TfName}} {{- if or (eq .Type "String") (eq .Type "Int64") (eq .Type "Float64") (eq .Type "Bool")}} - if value := res.Get("{{if $openApi}}response.{{end}}{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); value.Exists() { + if value := res.Get("{{if $openApi}}response.{{end}}{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); value.Exists() && value.Type != gjson.Null { data.{{toGoName .TfName}} = types.{{.Type}}Value(value.{{if eq .Type "Int64"}}Int{{else if eq .Type "Float64"}}Float{{else}}{{.Type}}{{end}}()) } else { {{- if .DefaultValue}} @@ -318,7 +318,7 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) {{- $ccname := toGoName .TfName}} {{- if and (not .Value) (not .WriteOnly) (not .Reference)}} {{- if or (eq .Type "String") (eq .Type "Int64") (eq .Type "Float64") (eq .Type "Bool")}} - if cValue := v.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); cValue.Exists() { + if cValue := v.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); cValue.Exists() && cValue.Type != gjson.Null { item.{{toGoName .TfName}} = types.{{.Type}}Value(cValue.{{if eq .Type "Int64"}}Int{{else if eq .Type "Float64"}}Float{{else}}{{.Type}}{{end}}()) } else { {{- if .DefaultValue}} @@ -347,7 +347,7 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) {{- range .Attributes}} {{- if and (not .Value) (not .WriteOnly) (not .Reference)}} {{- if or (eq .Type "String") (eq .Type "Int64") (eq .Type "Float64") (eq .Type "Bool")}} - if ccValue := cv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); ccValue.Exists() { + if ccValue := cv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.{{toGoName .TfName}} = types.{{.Type}}Value(ccValue.{{if eq .Type "Int64"}}Int{{else if eq .Type "Float64"}}Float{{else}}{{.Type}}{{end}}()) } else { {{- if .DefaultValue}} @@ -376,7 +376,7 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) {{- range .Attributes}} {{- if and (not .Value) (not .WriteOnly) (not .Reference)}} {{- if or (eq .Type "String") (eq .Type "Int64") (eq .Type "Float64") (eq .Type "Bool")}} - if cccValue := ccv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); cccValue.Exists() { + if cccValue := ccv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); cccValue.Exists() && cccValue.Type != gjson.Null { ccItem.{{toGoName .TfName}} = types.{{.Type}}Value(cccValue.{{if eq .Type "Int64"}}Int{{else if eq .Type "Float64"}}Float{{else}}{{.Type}}{{end}}()) } else { {{- if .DefaultValue}} diff --git a/internal/provider/model_ise_active_directory_add_groups.go b/internal/provider/model_ise_active_directory_add_groups.go index 5e0c984..872cdc0 100644 --- a/internal/provider/model_ise_active_directory_add_groups.go +++ b/internal/provider/model_ise_active_directory_add_groups.go @@ -104,27 +104,27 @@ func (data ActiveDirectoryAddGroups) toBody(ctx context.Context, state ActiveDir //template:begin fromBody func (data *ActiveDirectoryAddGroups) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("ERSActiveDirectory.name"); value.Exists() { + if value := res.Get("ERSActiveDirectory.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("ERSActiveDirectory.description"); value.Exists() { + if value := res.Get("ERSActiveDirectory.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("ERSActiveDirectory.domain"); value.Exists() { + if value := res.Get("ERSActiveDirectory.domain"); value.Exists() && value.Type != gjson.Null { data.Domain = types.StringValue(value.String()) } else { data.Domain = types.StringNull() } - if value := res.Get("ERSActiveDirectory.adScopesNames"); value.Exists() { + if value := res.Get("ERSActiveDirectory.adScopesNames"); value.Exists() && value.Type != gjson.Null { data.AdScopesNames = types.StringValue(value.String()) } else { data.AdScopesNames = types.StringValue("Default_Scope") } - if value := res.Get("ERSActiveDirectory.enableDomainAllowedList"); value.Exists() { + if value := res.Get("ERSActiveDirectory.enableDomainAllowedList"); value.Exists() && value.Type != gjson.Null { data.EnableDomainAllowedList = types.BoolValue(value.Bool()) } else { data.EnableDomainAllowedList = types.BoolValue(true) @@ -133,12 +133,12 @@ func (data *ActiveDirectoryAddGroups) fromBody(ctx context.Context, res gjson.Re data.Groups = make([]ActiveDirectoryAddGroupsGroups, 0) value.ForEach(func(k, v gjson.Result) bool { item := ActiveDirectoryAddGroupsGroups{} - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("sid"); cValue.Exists() { + if cValue := v.Get("sid"); cValue.Exists() && cValue.Type != gjson.Null { item.Sid = types.StringValue(cValue.String()) } else { item.Sid = types.StringNull() diff --git a/internal/provider/model_ise_active_directory_join_domain_with_all_nodes.go b/internal/provider/model_ise_active_directory_join_domain_with_all_nodes.go index 1b302a4..18a681d 100644 --- a/internal/provider/model_ise_active_directory_join_domain_with_all_nodes.go +++ b/internal/provider/model_ise_active_directory_join_domain_with_all_nodes.go @@ -88,12 +88,12 @@ func (data *ActiveDirectoryJoinDomainWithAllNodes) fromBody(ctx context.Context, data.AdditionalData = make([]ActiveDirectoryJoinDomainWithAllNodesAdditionalData, 0) value.ForEach(func(k, v gjson.Result) bool { item := ActiveDirectoryJoinDomainWithAllNodesAdditionalData{} - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("value"); cValue.Exists() { + if cValue := v.Get("value"); cValue.Exists() && cValue.Type != gjson.Null { item.Value = types.StringValue(cValue.String()) } else { item.Value = types.StringNull() diff --git a/internal/provider/model_ise_active_directory_join_point.go b/internal/provider/model_ise_active_directory_join_point.go index cfd3978..b1dcc27 100644 --- a/internal/provider/model_ise_active_directory_join_point.go +++ b/internal/provider/model_ise_active_directory_join_point.go @@ -251,27 +251,27 @@ func (data ActiveDirectoryJoinPoint) toBody(ctx context.Context, state ActiveDir //template:begin fromBody func (data *ActiveDirectoryJoinPoint) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("ERSActiveDirectory.name"); value.Exists() { + if value := res.Get("ERSActiveDirectory.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("ERSActiveDirectory.description"); value.Exists() { + if value := res.Get("ERSActiveDirectory.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("ERSActiveDirectory.domain"); value.Exists() { + if value := res.Get("ERSActiveDirectory.domain"); value.Exists() && value.Type != gjson.Null { data.Domain = types.StringValue(value.String()) } else { data.Domain = types.StringNull() } - if value := res.Get("ERSActiveDirectory.adScopesNames"); value.Exists() { + if value := res.Get("ERSActiveDirectory.adScopesNames"); value.Exists() && value.Type != gjson.Null { data.AdScopesNames = types.StringValue(value.String()) } else { data.AdScopesNames = types.StringValue("Default_Scope") } - if value := res.Get("ERSActiveDirectory.enableDomainAllowedList"); value.Exists() { + if value := res.Get("ERSActiveDirectory.enableDomainAllowedList"); value.Exists() && value.Type != gjson.Null { data.EnableDomainAllowedList = types.BoolValue(value.Bool()) } else { data.EnableDomainAllowedList = types.BoolValue(true) @@ -280,12 +280,12 @@ func (data *ActiveDirectoryJoinPoint) fromBody(ctx context.Context, res gjson.Re data.Groups = make([]ActiveDirectoryJoinPointGroups, 0) value.ForEach(func(k, v gjson.Result) bool { item := ActiveDirectoryJoinPointGroups{} - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("sid"); cValue.Exists() { + if cValue := v.Get("sid"); cValue.Exists() && cValue.Type != gjson.Null { item.Sid = types.StringValue(cValue.String()) } else { item.Sid = types.StringNull() @@ -298,22 +298,22 @@ func (data *ActiveDirectoryJoinPoint) fromBody(ctx context.Context, res gjson.Re data.Attributes = make([]ActiveDirectoryJoinPointAttributes, 0) value.ForEach(func(k, v gjson.Result) bool { item := ActiveDirectoryJoinPointAttributes{} - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("type"); cValue.Exists() { + if cValue := v.Get("type"); cValue.Exists() && cValue.Type != gjson.Null { item.Type = types.StringValue(cValue.String()) } else { item.Type = types.StringNull() } - if cValue := v.Get("internalName"); cValue.Exists() { + if cValue := v.Get("internalName"); cValue.Exists() && cValue.Type != gjson.Null { item.InternalName = types.StringValue(cValue.String()) } else { item.InternalName = types.StringNull() } - if cValue := v.Get("defaultValue"); cValue.Exists() { + if cValue := v.Get("defaultValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DefaultValue = types.StringValue(cValue.String()) } else { item.DefaultValue = types.StringNull() @@ -326,17 +326,17 @@ func (data *ActiveDirectoryJoinPoint) fromBody(ctx context.Context, res gjson.Re data.RewriteRules = make([]ActiveDirectoryJoinPointRewriteRules, 0) value.ForEach(func(k, v gjson.Result) bool { item := ActiveDirectoryJoinPointRewriteRules{} - if cValue := v.Get("rowId"); cValue.Exists() { + if cValue := v.Get("rowId"); cValue.Exists() && cValue.Type != gjson.Null { item.RowId = types.StringValue(cValue.String()) } else { item.RowId = types.StringNull() } - if cValue := v.Get("rewriteMatch"); cValue.Exists() { + if cValue := v.Get("rewriteMatch"); cValue.Exists() && cValue.Type != gjson.Null { item.RewriteMatch = types.StringValue(cValue.String()) } else { item.RewriteMatch = types.StringNull() } - if cValue := v.Get("rewriteResult"); cValue.Exists() { + if cValue := v.Get("rewriteResult"); cValue.Exists() && cValue.Type != gjson.Null { item.RewriteResult = types.StringValue(cValue.String()) } else { item.RewriteResult = types.StringNull() @@ -345,127 +345,127 @@ func (data *ActiveDirectoryJoinPoint) fromBody(ctx context.Context, res gjson.Re return true }) } - if value := res.Get("ERSActiveDirectory.advancedSettings.enableRewrites"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.enableRewrites"); value.Exists() && value.Type != gjson.Null { data.EnableRewrites = types.BoolValue(value.Bool()) } else { data.EnableRewrites = types.BoolValue(false) } - if value := res.Get("ERSActiveDirectory.advancedSettings.enablePassChange"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.enablePassChange"); value.Exists() && value.Type != gjson.Null { data.EnablePassChange = types.BoolValue(value.Bool()) } else { data.EnablePassChange = types.BoolValue(true) } - if value := res.Get("ERSActiveDirectory.advancedSettings.enableMachineAuth"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.enableMachineAuth"); value.Exists() && value.Type != gjson.Null { data.EnableMachineAuth = types.BoolValue(value.Bool()) } else { data.EnableMachineAuth = types.BoolValue(true) } - if value := res.Get("ERSActiveDirectory.advancedSettings.enableMachineAccess"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.enableMachineAccess"); value.Exists() && value.Type != gjson.Null { data.EnableMachineAccess = types.BoolValue(value.Bool()) } else { data.EnableMachineAccess = types.BoolValue(true) } - if value := res.Get("ERSActiveDirectory.advancedSettings.enableDialinPermissionCheck"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.enableDialinPermissionCheck"); value.Exists() && value.Type != gjson.Null { data.EnableDialinPermissionCheck = types.BoolValue(value.Bool()) } else { data.EnableDialinPermissionCheck = types.BoolValue(false) } - if value := res.Get("ERSActiveDirectory.advancedSettings.plaintextAuth"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.plaintextAuth"); value.Exists() && value.Type != gjson.Null { data.PlaintextAuth = types.BoolValue(value.Bool()) } else { data.PlaintextAuth = types.BoolValue(false) } - if value := res.Get("ERSActiveDirectory.advancedSettings.agingTime"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.agingTime"); value.Exists() && value.Type != gjson.Null { data.AgingTime = types.Int64Value(value.Int()) } else { data.AgingTime = types.Int64Value(5) } - if value := res.Get("ERSActiveDirectory.advancedSettings.enableCallbackForDialinClient"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.enableCallbackForDialinClient"); value.Exists() && value.Type != gjson.Null { data.EnableCallbackForDialinClient = types.BoolValue(value.Bool()) } else { data.EnableCallbackForDialinClient = types.BoolValue(false) } - if value := res.Get("ERSActiveDirectory.advancedSettings.identityNotInAdBehaviour"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.identityNotInAdBehaviour"); value.Exists() && value.Type != gjson.Null { data.IdentityNotInAdBehaviour = types.StringValue(value.String()) } else { data.IdentityNotInAdBehaviour = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.unreachableDomainsBehaviour"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.unreachableDomainsBehaviour"); value.Exists() && value.Type != gjson.Null { data.UnreachableDomainsBehaviour = types.StringValue(value.String()) } else { data.UnreachableDomainsBehaviour = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.schema"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.schema"); value.Exists() && value.Type != gjson.Null { data.Schema = types.StringValue(value.String()) } else { data.Schema = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.firstName"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.firstName"); value.Exists() && value.Type != gjson.Null { data.FirstName = types.StringValue(value.String()) } else { data.FirstName = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.department"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.department"); value.Exists() && value.Type != gjson.Null { data.Department = types.StringValue(value.String()) } else { data.Department = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.lastName"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.lastName"); value.Exists() && value.Type != gjson.Null { data.LastName = types.StringValue(value.String()) } else { data.LastName = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.organizationalUnit"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.organizationalUnit"); value.Exists() && value.Type != gjson.Null { data.OrganizationalUnit = types.StringValue(value.String()) } else { data.OrganizationalUnit = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.jobTitle"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.jobTitle"); value.Exists() && value.Type != gjson.Null { data.JobTitle = types.StringValue(value.String()) } else { data.JobTitle = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.locality"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.locality"); value.Exists() && value.Type != gjson.Null { data.Locality = types.StringValue(value.String()) } else { data.Locality = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.email"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.email"); value.Exists() && value.Type != gjson.Null { data.Email = types.StringValue(value.String()) } else { data.Email = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.stateOrProvince"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.stateOrProvince"); value.Exists() && value.Type != gjson.Null { data.StateOrProvince = types.StringValue(value.String()) } else { data.StateOrProvince = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.telephone"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.telephone"); value.Exists() && value.Type != gjson.Null { data.Telephone = types.StringValue(value.String()) } else { data.Telephone = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.country"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.country"); value.Exists() && value.Type != gjson.Null { data.Country = types.StringValue(value.String()) } else { data.Country = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.streetAddress"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.streetAddress"); value.Exists() && value.Type != gjson.Null { data.StreetAddress = types.StringValue(value.String()) } else { data.StreetAddress = types.StringNull() } - if value := res.Get("ERSActiveDirectory.advancedSettings.enableFailedAuthProtection"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.enableFailedAuthProtection"); value.Exists() && value.Type != gjson.Null { data.EnableFailedAuthProtection = types.BoolValue(value.Bool()) } else { data.EnableFailedAuthProtection = types.BoolValue(false) } - if value := res.Get("ERSActiveDirectory.advancedSettings.failedAuthThreshold"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.failedAuthThreshold"); value.Exists() && value.Type != gjson.Null { data.FailedAuthThreshold = types.Int64Value(value.Int()) } else { data.FailedAuthThreshold = types.Int64Value(5) } - if value := res.Get("ERSActiveDirectory.advancedSettings.authProtectionType"); value.Exists() { + if value := res.Get("ERSActiveDirectory.advancedSettings.authProtectionType"); value.Exists() && value.Type != gjson.Null { data.AuthProtectionType = types.StringValue(value.String()) } else { data.AuthProtectionType = types.StringNull() diff --git a/internal/provider/model_ise_allowed_protocols.go b/internal/provider/model_ise_allowed_protocols.go index 52e5234..b61538b 100644 --- a/internal/provider/model_ise_allowed_protocols.go +++ b/internal/provider/model_ise_allowed_protocols.go @@ -366,382 +366,382 @@ func (data AllowedProtocols) toBody(ctx context.Context, state AllowedProtocols) //template:begin fromBody func (data *AllowedProtocols) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("AllowedProtocols.name"); value.Exists() { + if value := res.Get("AllowedProtocols.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("AllowedProtocols.description"); value.Exists() { + if value := res.Get("AllowedProtocols.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("AllowedProtocols.processHostLookup"); value.Exists() { + if value := res.Get("AllowedProtocols.processHostLookup"); value.Exists() && value.Type != gjson.Null { data.ProcessHostLookup = types.BoolValue(value.Bool()) } else { data.ProcessHostLookup = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowPapAscii"); value.Exists() { + if value := res.Get("AllowedProtocols.allowPapAscii"); value.Exists() && value.Type != gjson.Null { data.AllowPapAscii = types.BoolValue(value.Bool()) } else { data.AllowPapAscii = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowChap"); value.Exists() { + if value := res.Get("AllowedProtocols.allowChap"); value.Exists() && value.Type != gjson.Null { data.AllowChap = types.BoolValue(value.Bool()) } else { data.AllowChap = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowMsChapV1"); value.Exists() { + if value := res.Get("AllowedProtocols.allowMsChapV1"); value.Exists() && value.Type != gjson.Null { data.AllowMsChapV1 = types.BoolValue(value.Bool()) } else { data.AllowMsChapV1 = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowMsChapV2"); value.Exists() { + if value := res.Get("AllowedProtocols.allowMsChapV2"); value.Exists() && value.Type != gjson.Null { data.AllowMsChapV2 = types.BoolValue(value.Bool()) } else { data.AllowMsChapV2 = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowEapMd5"); value.Exists() { + if value := res.Get("AllowedProtocols.allowEapMd5"); value.Exists() && value.Type != gjson.Null { data.AllowEapMd5 = types.BoolValue(value.Bool()) } else { data.AllowEapMd5 = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowLeap"); value.Exists() { + if value := res.Get("AllowedProtocols.allowLeap"); value.Exists() && value.Type != gjson.Null { data.AllowLeap = types.BoolValue(value.Bool()) } else { data.AllowLeap = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowEapTls"); value.Exists() { + if value := res.Get("AllowedProtocols.allowEapTls"); value.Exists() && value.Type != gjson.Null { data.AllowEapTls = types.BoolValue(value.Bool()) } else { data.AllowEapTls = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowEapTtls"); value.Exists() { + if value := res.Get("AllowedProtocols.allowEapTtls"); value.Exists() && value.Type != gjson.Null { data.AllowEapTtls = types.BoolValue(value.Bool()) } else { data.AllowEapTtls = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowEapFast"); value.Exists() { + if value := res.Get("AllowedProtocols.allowEapFast"); value.Exists() && value.Type != gjson.Null { data.AllowEapFast = types.BoolValue(value.Bool()) } else { data.AllowEapFast = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowPeap"); value.Exists() { + if value := res.Get("AllowedProtocols.allowPeap"); value.Exists() && value.Type != gjson.Null { data.AllowPeap = types.BoolValue(value.Bool()) } else { data.AllowPeap = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowTeap"); value.Exists() { + if value := res.Get("AllowedProtocols.allowTeap"); value.Exists() && value.Type != gjson.Null { data.AllowTeap = types.BoolValue(value.Bool()) } else { data.AllowTeap = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowPreferredEapProtocol"); value.Exists() { + if value := res.Get("AllowedProtocols.allowPreferredEapProtocol"); value.Exists() && value.Type != gjson.Null { data.AllowPreferredEapProtocol = types.BoolValue(value.Bool()) } else { data.AllowPreferredEapProtocol = types.BoolNull() } - if value := res.Get("AllowedProtocols.preferredEapProtocol"); value.Exists() { + if value := res.Get("AllowedProtocols.preferredEapProtocol"); value.Exists() && value.Type != gjson.Null { data.PreferredEapProtocol = types.StringValue(value.String()) } else { data.PreferredEapProtocol = types.StringNull() } - if value := res.Get("AllowedProtocols.eapTlsLBit"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTlsLBit"); value.Exists() && value.Type != gjson.Null { data.EapTlsLBit = types.BoolValue(value.Bool()) } else { data.EapTlsLBit = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowWeakCiphersForEap"); value.Exists() { + if value := res.Get("AllowedProtocols.allowWeakCiphersForEap"); value.Exists() && value.Type != gjson.Null { data.AllowWeakCiphersForEap = types.BoolValue(value.Bool()) } else { data.AllowWeakCiphersForEap = types.BoolNull() } - if value := res.Get("AllowedProtocols.requireMessageAuth"); value.Exists() { + if value := res.Get("AllowedProtocols.requireMessageAuth"); value.Exists() && value.Type != gjson.Null { data.RequireMessageAuth = types.BoolValue(value.Bool()) } else { data.RequireMessageAuth = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTls.allowEapTlsAuthOfExpiredCerts"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTls.allowEapTlsAuthOfExpiredCerts"); value.Exists() && value.Type != gjson.Null { data.EapTlsAllowAuthOfExpiredCerts = types.BoolValue(value.Bool()) } else { data.EapTlsAllowAuthOfExpiredCerts = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTls.eapTlsEnableStatelessSessionResume"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTls.eapTlsEnableStatelessSessionResume"); value.Exists() && value.Type != gjson.Null { data.EapTlsEnableStatelessSessionResume = types.BoolValue(value.Bool()) } else { data.EapTlsEnableStatelessSessionResume = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTls.eapTlsSessionTicketTtl"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTls.eapTlsSessionTicketTtl"); value.Exists() && value.Type != gjson.Null { data.EapTlsSessionTicketTtl = types.Int64Value(value.Int()) } else { data.EapTlsSessionTicketTtl = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapTls.eapTlsSessionTicketTtlUnits"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTls.eapTlsSessionTicketTtlUnits"); value.Exists() && value.Type != gjson.Null { data.EapTlsSessionTicketTtlUnit = types.StringValue(value.String()) } else { data.EapTlsSessionTicketTtlUnit = types.StringNull() } - if value := res.Get("AllowedProtocols.eapTls.eapTlsSessionTicketPrecentage"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTls.eapTlsSessionTicketPrecentage"); value.Exists() && value.Type != gjson.Null { data.EapTlsSessionTicketPercentage = types.Int64Value(value.Int()) } else { data.EapTlsSessionTicketPercentage = types.Int64Null() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapMsChapV2"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapMsChapV2"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapMsChapV2 = types.BoolValue(value.Bool()) } else { data.PeapAllowPeapEapMsChapV2 = types.BoolNull() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapMsChapV2PwdChange"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapMsChapV2PwdChange"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapMsChapV2PwdChange = types.BoolValue(value.Bool()) } else { data.PeapAllowPeapEapMsChapV2PwdChange = types.BoolNull() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapMsChapV2PwdChangeRetries"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapMsChapV2PwdChangeRetries"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapMsChapV2PwdChangeRetries = types.Int64Value(value.Int()) } else { data.PeapAllowPeapEapMsChapV2PwdChangeRetries = types.Int64Null() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapGtc"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapGtc"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapGtc = types.BoolValue(value.Bool()) } else { data.PeapAllowPeapEapGtc = types.BoolNull() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapGtcPwdChange"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapGtcPwdChange"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapGtcPwdChange = types.BoolValue(value.Bool()) } else { data.PeapAllowPeapEapGtcPwdChange = types.BoolNull() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapGtcPwdChangeRetries"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapGtcPwdChangeRetries"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapGtcPwdChangeRetries = types.Int64Value(value.Int()) } else { data.PeapAllowPeapEapGtcPwdChangeRetries = types.Int64Null() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapTls"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapTls"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapTls = types.BoolValue(value.Bool()) } else { data.PeapAllowPeapEapTls = types.BoolNull() } - if value := res.Get("AllowedProtocols.peap.allowPeapEapTlsAuthOfExpiredCerts"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapEapTlsAuthOfExpiredCerts"); value.Exists() && value.Type != gjson.Null { data.PeapAllowPeapEapTlsAuthOfExpiredCerts = types.BoolValue(value.Bool()) } else { data.PeapAllowPeapEapTlsAuthOfExpiredCerts = types.BoolNull() } - if value := res.Get("AllowedProtocols.peap.requireCryptobinding"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.requireCryptobinding"); value.Exists() && value.Type != gjson.Null { data.RequireCryptobinding = types.BoolValue(value.Bool()) } else { data.RequireCryptobinding = types.BoolNull() } - if value := res.Get("AllowedProtocols.peap.allowPeapV0"); value.Exists() { + if value := res.Get("AllowedProtocols.peap.allowPeapV0"); value.Exists() && value.Type != gjson.Null { data.PeapPeapV0 = types.BoolValue(value.Bool()) } else { data.PeapPeapV0 = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsPapAscii"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsPapAscii"); value.Exists() && value.Type != gjson.Null { data.EapTtlsPapAscii = types.BoolValue(value.Bool()) } else { data.EapTtlsPapAscii = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsChap"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsChap"); value.Exists() && value.Type != gjson.Null { data.EapTtlsChap = types.BoolValue(value.Bool()) } else { data.EapTtlsChap = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsMsChapV1"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsMsChapV1"); value.Exists() && value.Type != gjson.Null { data.EapTtlsMsChapV1 = types.BoolValue(value.Bool()) } else { data.EapTtlsMsChapV1 = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsMsChapV2"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsMsChapV2"); value.Exists() && value.Type != gjson.Null { data.EapTtlsMsChapV2 = types.BoolValue(value.Bool()) } else { data.EapTtlsMsChapV2 = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMd5"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMd5"); value.Exists() && value.Type != gjson.Null { data.EapTtlsEapMd5 = types.BoolValue(value.Bool()) } else { data.EapTtlsEapMd5 = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMsChapV2"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMsChapV2"); value.Exists() && value.Type != gjson.Null { data.EapTtlsEapMsChapV2 = types.BoolValue(value.Bool()) } else { data.EapTtlsEapMsChapV2 = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMsChapV2PwdChange"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMsChapV2PwdChange"); value.Exists() && value.Type != gjson.Null { data.EapTtlsEapMsChapV2PwdChange = types.BoolValue(value.Bool()) } else { data.EapTtlsEapMsChapV2PwdChange = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMsChapV2PwdChangeRetries"); value.Exists() { + if value := res.Get("AllowedProtocols.eapTtls.eapTtlsEapMsChapV2PwdChangeRetries"); value.Exists() && value.Type != gjson.Null { data.EapTtlsEapMsChapV2PwdChangeRetries = types.Int64Value(value.Int()) } else { data.EapTtlsEapMsChapV2PwdChangeRetries = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapMsChapV2"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapMsChapV2"); value.Exists() && value.Type != gjson.Null { data.EapFastEapMsChapV2 = types.BoolValue(value.Bool()) } else { data.EapFastEapMsChapV2 = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapMsChapV2PwdChange"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapMsChapV2PwdChange"); value.Exists() && value.Type != gjson.Null { data.EapFastEapMsChapV2PwdChange = types.BoolValue(value.Bool()) } else { data.EapFastEapMsChapV2PwdChange = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapMsChapV2PwdChangeRetries"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapMsChapV2PwdChangeRetries"); value.Exists() && value.Type != gjson.Null { data.EapFastEapMsChapV2PwdChangeRetries = types.Int64Value(value.Int()) } else { data.EapFastEapMsChapV2PwdChangeRetries = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapGtc"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapGtc"); value.Exists() && value.Type != gjson.Null { data.EapFastEapGtc = types.BoolValue(value.Bool()) } else { data.EapFastEapGtc = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapGtcPwdChange"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapGtcPwdChange"); value.Exists() && value.Type != gjson.Null { data.EapFastEapGtcPwdChange = types.BoolValue(value.Bool()) } else { data.EapFastEapGtcPwdChange = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapGtcPwdChangeRetries"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapGtcPwdChangeRetries"); value.Exists() && value.Type != gjson.Null { data.EapFastEapGtcPwdChangeRetries = types.Int64Value(value.Int()) } else { data.EapFastEapGtcPwdChangeRetries = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapTls"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapTls"); value.Exists() && value.Type != gjson.Null { data.EapFastEapTls = types.BoolValue(value.Bool()) } else { data.EapFastEapTls = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapTlsAuthOfExpiredCerts"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.allowEapFastEapTlsAuthOfExpiredCerts"); value.Exists() && value.Type != gjson.Null { data.EapFastEapTlsAuthOfExpiredCerts = types.BoolValue(value.Bool()) } else { data.EapFastEapTlsAuthOfExpiredCerts = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastEnableEAPChaining"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastEnableEAPChaining"); value.Exists() && value.Type != gjson.Null { data.EapFastEnableEapChaining = types.BoolValue(value.Bool()) } else { data.EapFastEnableEapChaining = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacs"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacs"); value.Exists() && value.Type != gjson.Null { data.EapFastUsePacs = types.BoolValue(value.Bool()) } else { data.EapFastUsePacs = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsTunnelPacTtl"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsTunnelPacTtl"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsTunnelPacTtl = types.Int64Value(value.Int()) } else { data.EapFastPacsTunnelPacTtl = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsTunnelPacTtlUnits"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsTunnelPacTtlUnits"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsTunnelPacTtlUnit = types.StringValue(value.String()) } else { data.EapFastPacsTunnelPacTtlUnit = types.StringNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsUseProactivePacUpdatePrecentage"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsUseProactivePacUpdatePrecentage"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsUseProactivePacUpdatePercentage = types.Int64Value(value.Int()) } else { data.EapFastPacsUseProactivePacUpdatePercentage = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAllowAnonymProvisioning"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAllowAnonymProvisioning"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsAllowAnonymousProvisioning = types.BoolValue(value.Bool()) } else { data.EapFastPacsAllowAnonymousProvisioning = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAllowAuthenProvisioning"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAllowAuthenProvisioning"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsAllowAuthenticatedProvisioning = types.BoolValue(value.Bool()) } else { data.EapFastPacsAllowAuthenticatedProvisioning = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsServerReturns"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsServerReturns"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsServerReturns = types.BoolValue(value.Bool()) } else { data.EapFastPacsServerReturns = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAcceptClientCert"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAcceptClientCert"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsAllowClientCert = types.BoolValue(value.Bool()) } else { data.EapFastPacsAllowClientCert = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAllowMachineAuthentication"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAllowMachineAuthentication"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsAllowMachineAuthentication = types.BoolValue(value.Bool()) } else { data.EapFastPacsAllowMachineAuthentication = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsMachinePacTtl"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsMachinePacTtl"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsMachinePacTtl = types.Int64Value(value.Int()) } else { data.EapFastPacsMachinePacTtl = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsMachinePacTtlUnits"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsMachinePacTtlUnits"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsMachinePacTtlUnit = types.StringValue(value.String()) } else { data.EapFastPacsMachinePacTtlUnit = types.StringNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsStatelessSessionResume"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsStatelessSessionResume"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsStatelessSessionResume = types.BoolValue(value.Bool()) } else { data.EapFastPacsStatelessSessionResume = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAuthorizationPacTtl"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAuthorizationPacTtl"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsAuthorizationPacTtl = types.Int64Value(value.Int()) } else { data.EapFastPacsAuthorizationPacTtl = types.Int64Null() } - if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAuthorizationPacTtlUnits"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastUsePacsAuthorizationPacTtlUnits"); value.Exists() && value.Type != gjson.Null { data.EapFastPacsAuthorizationPacTtlUnit = types.StringValue(value.String()) } else { data.EapFastPacsAuthorizationPacTtlUnit = types.StringNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastDontUsePacsAcceptClientCert"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastDontUsePacsAcceptClientCert"); value.Exists() && value.Type != gjson.Null { data.EapFastAcceptClientCert = types.BoolValue(value.Bool()) } else { data.EapFastAcceptClientCert = types.BoolNull() } - if value := res.Get("AllowedProtocols.eapFast.eapFastDontUsePacsAllowMachineAuthentication"); value.Exists() { + if value := res.Get("AllowedProtocols.eapFast.eapFastDontUsePacsAllowMachineAuthentication"); value.Exists() && value.Type != gjson.Null { data.EapFastAllowMachineAuthentication = types.BoolValue(value.Bool()) } else { data.EapFastAllowMachineAuthentication = types.BoolNull() } - if value := res.Get("AllowedProtocols.teap.allowTeapEapMsChapV2"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.allowTeapEapMsChapV2"); value.Exists() && value.Type != gjson.Null { data.TeapEapMsChapV2 = types.BoolValue(value.Bool()) } else { data.TeapEapMsChapV2 = types.BoolNull() } - if value := res.Get("AllowedProtocols.teap.allowTeapEapMsChapV2PwdChange"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.allowTeapEapMsChapV2PwdChange"); value.Exists() && value.Type != gjson.Null { data.TeapEapMsChapV2PwdChange = types.BoolValue(value.Bool()) } else { data.TeapEapMsChapV2PwdChange = types.BoolNull() } - if value := res.Get("AllowedProtocols.teap.allowTeapEapMsChapV2PwdChangeRetries"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.allowTeapEapMsChapV2PwdChangeRetries"); value.Exists() && value.Type != gjson.Null { data.TeapEapMsChapV2PwdChangeRetries = types.Int64Value(value.Int()) } else { data.TeapEapMsChapV2PwdChangeRetries = types.Int64Null() } - if value := res.Get("AllowedProtocols.teap.allowTeapEapTls"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.allowTeapEapTls"); value.Exists() && value.Type != gjson.Null { data.TeapEapTls = types.BoolValue(value.Bool()) } else { data.TeapEapTls = types.BoolNull() } - if value := res.Get("AllowedProtocols.teap.allowTeapEapTlsAuthOfExpiredCerts"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.allowTeapEapTlsAuthOfExpiredCerts"); value.Exists() && value.Type != gjson.Null { data.TeapEapTlsAuthOfExpiredCerts = types.BoolValue(value.Bool()) } else { data.TeapEapTlsAuthOfExpiredCerts = types.BoolNull() } - if value := res.Get("AllowedProtocols.teap.acceptClientCertDuringTunnelEst"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.acceptClientCertDuringTunnelEst"); value.Exists() && value.Type != gjson.Null { data.TeapEapAcceptClientCertDuringTunnelEst = types.BoolValue(value.Bool()) } else { data.TeapEapAcceptClientCertDuringTunnelEst = types.BoolNull() } - if value := res.Get("AllowedProtocols.teap.enableEapChaining"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.enableEapChaining"); value.Exists() && value.Type != gjson.Null { data.TeapEapChaining = types.BoolValue(value.Bool()) } else { data.TeapEapChaining = types.BoolNull() } - if value := res.Get("AllowedProtocols.teap.allowDowngradeMsk"); value.Exists() { + if value := res.Get("AllowedProtocols.teap.allowDowngradeMsk"); value.Exists() && value.Type != gjson.Null { data.TeapDowngradeMsk = types.BoolValue(value.Bool()) } else { data.TeapDowngradeMsk = types.BoolNull() } - if value := res.Get("AllowedProtocols.fiveG"); value.Exists() { + if value := res.Get("AllowedProtocols.fiveG"); value.Exists() && value.Type != gjson.Null { data.Allow5g = types.BoolValue(value.Bool()) } else { data.Allow5g = types.BoolNull() diff --git a/internal/provider/model_ise_allowed_protocols_tacacs.go b/internal/provider/model_ise_allowed_protocols_tacacs.go index 587e3f0..cf3e105 100644 --- a/internal/provider/model_ise_allowed_protocols_tacacs.go +++ b/internal/provider/model_ise_allowed_protocols_tacacs.go @@ -92,27 +92,27 @@ func (data AllowedProtocolsTACACS) toBody(ctx context.Context, state AllowedProt //template:begin fromBody func (data *AllowedProtocolsTACACS) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("AllowedProtocols.name"); value.Exists() { + if value := res.Get("AllowedProtocols.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("AllowedProtocols.description"); value.Exists() { + if value := res.Get("AllowedProtocols.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("AllowedProtocols.allowPapAscii"); value.Exists() { + if value := res.Get("AllowedProtocols.allowPapAscii"); value.Exists() && value.Type != gjson.Null { data.AllowPapAscii = types.BoolValue(value.Bool()) } else { data.AllowPapAscii = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowChap"); value.Exists() { + if value := res.Get("AllowedProtocols.allowChap"); value.Exists() && value.Type != gjson.Null { data.AllowChap = types.BoolValue(value.Bool()) } else { data.AllowChap = types.BoolNull() } - if value := res.Get("AllowedProtocols.allowMsChapV1"); value.Exists() { + if value := res.Get("AllowedProtocols.allowMsChapV1"); value.Exists() && value.Type != gjson.Null { data.AllowMsChapV1 = types.BoolValue(value.Bool()) } else { data.AllowMsChapV1 = types.BoolNull() diff --git a/internal/provider/model_ise_authorization_profile.go b/internal/provider/model_ise_authorization_profile.go index 998c752..076f823 100644 --- a/internal/provider/model_ise_authorization_profile.go +++ b/internal/provider/model_ise_authorization_profile.go @@ -223,152 +223,152 @@ func (data AuthorizationProfile) toBody(ctx context.Context, state Authorization //template:begin fromBody func (data *AuthorizationProfile) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("AuthorizationProfile.name"); value.Exists() { + if value := res.Get("AuthorizationProfile.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("AuthorizationProfile.description"); value.Exists() { + if value := res.Get("AuthorizationProfile.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("AuthorizationProfile.vlan.nameID"); value.Exists() { + if value := res.Get("AuthorizationProfile.vlan.nameID"); value.Exists() && value.Type != gjson.Null { data.VlanNameId = types.StringValue(value.String()) } else { data.VlanNameId = types.StringNull() } - if value := res.Get("AuthorizationProfile.vlan.tagID"); value.Exists() { + if value := res.Get("AuthorizationProfile.vlan.tagID"); value.Exists() && value.Type != gjson.Null { data.VlanTagId = types.Int64Value(value.Int()) } else { data.VlanTagId = types.Int64Null() } - if value := res.Get("AuthorizationProfile.webRedirection.WebRedirectionType"); value.Exists() { + if value := res.Get("AuthorizationProfile.webRedirection.WebRedirectionType"); value.Exists() && value.Type != gjson.Null { data.WebRedirectionType = types.StringValue(value.String()) } else { data.WebRedirectionType = types.StringNull() } - if value := res.Get("AuthorizationProfile.webRedirection.acl"); value.Exists() { + if value := res.Get("AuthorizationProfile.webRedirection.acl"); value.Exists() && value.Type != gjson.Null { data.WebRedirectionAcl = types.StringValue(value.String()) } else { data.WebRedirectionAcl = types.StringNull() } - if value := res.Get("AuthorizationProfile.webRedirection.portalName"); value.Exists() { + if value := res.Get("AuthorizationProfile.webRedirection.portalName"); value.Exists() && value.Type != gjson.Null { data.WebRedirectionPortalName = types.StringValue(value.String()) } else { data.WebRedirectionPortalName = types.StringNull() } - if value := res.Get("AuthorizationProfile.webRedirection.staticIPHostNameFQDN"); value.Exists() { + if value := res.Get("AuthorizationProfile.webRedirection.staticIPHostNameFQDN"); value.Exists() && value.Type != gjson.Null { data.WebRedirectionStaticIpHostNameFqdn = types.StringValue(value.String()) } else { data.WebRedirectionStaticIpHostNameFqdn = types.StringNull() } - if value := res.Get("AuthorizationProfile.webRedirection.displayCertificatesRenewalMessages"); value.Exists() { + if value := res.Get("AuthorizationProfile.webRedirection.displayCertificatesRenewalMessages"); value.Exists() && value.Type != gjson.Null { data.WebRedirectionDisplayCertificatesRenewalMessages = types.BoolValue(value.Bool()) } else { data.WebRedirectionDisplayCertificatesRenewalMessages = types.BoolNull() } - if value := res.Get("AuthorizationProfile.agentlessPosture"); value.Exists() { + if value := res.Get("AuthorizationProfile.agentlessPosture"); value.Exists() && value.Type != gjson.Null { data.AgentlessPosture = types.BoolValue(value.Bool()) } else { data.AgentlessPosture = types.BoolNull() } - if value := res.Get("AuthorizationProfile.accessType"); value.Exists() { + if value := res.Get("AuthorizationProfile.accessType"); value.Exists() && value.Type != gjson.Null { data.AccessType = types.StringValue(value.String()) } else { data.AccessType = types.StringValue("ACCESS_ACCEPT") } - if value := res.Get("AuthorizationProfile.profileName"); value.Exists() { + if value := res.Get("AuthorizationProfile.profileName"); value.Exists() && value.Type != gjson.Null { data.ProfileName = types.StringValue(value.String()) } else { data.ProfileName = types.StringValue("Cisco") } - if value := res.Get("AuthorizationProfile.airespaceACL"); value.Exists() { + if value := res.Get("AuthorizationProfile.airespaceACL"); value.Exists() && value.Type != gjson.Null { data.AirespaceAcl = types.StringValue(value.String()) } else { data.AirespaceAcl = types.StringNull() } - if value := res.Get("AuthorizationProfile.acl"); value.Exists() { + if value := res.Get("AuthorizationProfile.acl"); value.Exists() && value.Type != gjson.Null { data.Acl = types.StringValue(value.String()) } else { data.Acl = types.StringNull() } - if value := res.Get("AuthorizationProfile.daclName"); value.Exists() { + if value := res.Get("AuthorizationProfile.daclName"); value.Exists() && value.Type != gjson.Null { data.DaclName = types.StringValue(value.String()) } else { data.DaclName = types.StringNull() } - if value := res.Get("AuthorizationProfile.autoSmartPort"); value.Exists() { + if value := res.Get("AuthorizationProfile.autoSmartPort"); value.Exists() && value.Type != gjson.Null { data.AutoSmartPort = types.StringValue(value.String()) } else { data.AutoSmartPort = types.StringNull() } - if value := res.Get("AuthorizationProfile.interfaceTemplate"); value.Exists() { + if value := res.Get("AuthorizationProfile.interfaceTemplate"); value.Exists() && value.Type != gjson.Null { data.InterfaceTemplate = types.StringValue(value.String()) } else { data.InterfaceTemplate = types.StringNull() } - if value := res.Get("AuthorizationProfile.ipv6ACLFilter"); value.Exists() { + if value := res.Get("AuthorizationProfile.ipv6ACLFilter"); value.Exists() && value.Type != gjson.Null { data.Ipv6AclFilter = types.StringValue(value.String()) } else { data.Ipv6AclFilter = types.StringNull() } - if value := res.Get("AuthorizationProfile.avcProfile"); value.Exists() { + if value := res.Get("AuthorizationProfile.avcProfile"); value.Exists() && value.Type != gjson.Null { data.AvcProfile = types.StringValue(value.String()) } else { data.AvcProfile = types.StringNull() } - if value := res.Get("AuthorizationProfile.asaVpn"); value.Exists() { + if value := res.Get("AuthorizationProfile.asaVpn"); value.Exists() && value.Type != gjson.Null { data.AsaVpn = types.StringValue(value.String()) } else { data.AsaVpn = types.StringNull() } - if value := res.Get("AuthorizationProfile.uniqueIdentifier"); value.Exists() { + if value := res.Get("AuthorizationProfile.uniqueIdentifier"); value.Exists() && value.Type != gjson.Null { data.UniqueIdentifier = types.StringValue(value.String()) } else { data.UniqueIdentifier = types.StringNull() } - if value := res.Get("AuthorizationProfile.trackMovement"); value.Exists() { + if value := res.Get("AuthorizationProfile.trackMovement"); value.Exists() && value.Type != gjson.Null { data.TrackMovement = types.BoolValue(value.Bool()) } else { data.TrackMovement = types.BoolValue(false) } - if value := res.Get("AuthorizationProfile.serviceTemplate"); value.Exists() { + if value := res.Get("AuthorizationProfile.serviceTemplate"); value.Exists() && value.Type != gjson.Null { data.ServiceTemplate = types.BoolValue(value.Bool()) } else { data.ServiceTemplate = types.BoolValue(false) } - if value := res.Get("AuthorizationProfile.easywiredSessionCandidate"); value.Exists() { + if value := res.Get("AuthorizationProfile.easywiredSessionCandidate"); value.Exists() && value.Type != gjson.Null { data.EasywiredSessionCandidate = types.BoolValue(value.Bool()) } else { data.EasywiredSessionCandidate = types.BoolValue(false) } - if value := res.Get("AuthorizationProfile.voiceDomainPermission"); value.Exists() { + if value := res.Get("AuthorizationProfile.voiceDomainPermission"); value.Exists() && value.Type != gjson.Null { data.VoiceDomainPermission = types.BoolValue(value.Bool()) } else { data.VoiceDomainPermission = types.BoolValue(false) } - if value := res.Get("AuthorizationProfile.neat"); value.Exists() { + if value := res.Get("AuthorizationProfile.neat"); value.Exists() && value.Type != gjson.Null { data.Neat = types.BoolValue(value.Bool()) } else { data.Neat = types.BoolValue(false) } - if value := res.Get("AuthorizationProfile.webAuth"); value.Exists() { + if value := res.Get("AuthorizationProfile.webAuth"); value.Exists() && value.Type != gjson.Null { data.WebAuth = types.BoolValue(value.Bool()) } else { data.WebAuth = types.BoolValue(false) } - if value := res.Get("AuthorizationProfile.macSecPolicy"); value.Exists() { + if value := res.Get("AuthorizationProfile.macSecPolicy"); value.Exists() && value.Type != gjson.Null { data.MacSecPolicy = types.StringValue(value.String()) } else { data.MacSecPolicy = types.StringNull() } - if value := res.Get("AuthorizationProfile.reauth.connectivity"); value.Exists() { + if value := res.Get("AuthorizationProfile.reauth.connectivity"); value.Exists() && value.Type != gjson.Null { data.ReauthenticationConnectivity = types.StringValue(value.String()) } else { data.ReauthenticationConnectivity = types.StringNull() } - if value := res.Get("AuthorizationProfile.reauth.timer"); value.Exists() { + if value := res.Get("AuthorizationProfile.reauth.timer"); value.Exists() && value.Type != gjson.Null { data.ReauthenticationTimer = types.Int64Value(value.Int()) } else { data.ReauthenticationTimer = types.Int64Null() @@ -377,32 +377,32 @@ func (data *AuthorizationProfile) fromBody(ctx context.Context, res gjson.Result data.AdvancedAttributes = make([]AuthorizationProfileAdvancedAttributes, 0) value.ForEach(func(k, v gjson.Result) bool { item := AuthorizationProfileAdvancedAttributes{} - if cValue := v.Get("leftHandSideDictionaryAttribue.dictionaryName"); cValue.Exists() { + if cValue := v.Get("leftHandSideDictionaryAttribue.dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeLeftDictionaryName = types.StringValue(cValue.String()) } else { item.AttributeLeftDictionaryName = types.StringNull() } - if cValue := v.Get("leftHandSideDictionaryAttribue.attributeName"); cValue.Exists() { + if cValue := v.Get("leftHandSideDictionaryAttribue.attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeLeftName = types.StringValue(cValue.String()) } else { item.AttributeLeftName = types.StringNull() } - if cValue := v.Get("rightHandSideAttribueValue.AdvancedAttributeValueType"); cValue.Exists() { + if cValue := v.Get("rightHandSideAttribueValue.AdvancedAttributeValueType"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeRightValueType = types.StringValue(cValue.String()) } else { item.AttributeRightValueType = types.StringNull() } - if cValue := v.Get("rightHandSideAttribueValue.value"); cValue.Exists() { + if cValue := v.Get("rightHandSideAttribueValue.value"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeRightValue = types.StringValue(cValue.String()) } else { item.AttributeRightValue = types.StringNull() } - if cValue := v.Get("rightHandSideAttribueValue.dictionaryName"); cValue.Exists() { + if cValue := v.Get("rightHandSideAttribueValue.dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeRightDictionaryName = types.StringValue(cValue.String()) } else { item.AttributeRightDictionaryName = types.StringNull() } - if cValue := v.Get("rightHandSideAttribueValue.attributeName"); cValue.Exists() { + if cValue := v.Get("rightHandSideAttribueValue.attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeRightName = types.StringValue(cValue.String()) } else { item.AttributeRightName = types.StringNull() @@ -411,12 +411,12 @@ func (data *AuthorizationProfile) fromBody(ctx context.Context, res gjson.Result return true }) } - if value := res.Get("AuthorizationProfile.ipv6DaclName"); value.Exists() { + if value := res.Get("AuthorizationProfile.ipv6DaclName"); value.Exists() && value.Type != gjson.Null { data.Ipv6DaclName = types.StringValue(value.String()) } else { data.Ipv6DaclName = types.StringNull() } - if value := res.Get("AuthorizationProfile.airespaceIPv6ACL"); value.Exists() { + if value := res.Get("AuthorizationProfile.airespaceIPv6ACL"); value.Exists() && value.Type != gjson.Null { data.AirespaceIpv6Acl = types.StringValue(value.String()) } else { data.AirespaceIpv6Acl = types.StringNull() diff --git a/internal/provider/model_ise_certificate_authentication_profile.go b/internal/provider/model_ise_certificate_authentication_profile.go index 0349d19..fe65e86 100644 --- a/internal/provider/model_ise_certificate_authentication_profile.go +++ b/internal/provider/model_ise_certificate_authentication_profile.go @@ -86,37 +86,37 @@ func (data CertificateAuthenticationProfile) toBody(ctx context.Context, state C //template:begin fromBody func (data *CertificateAuthenticationProfile) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("CertificateProfile.name"); value.Exists() { + if value := res.Get("CertificateProfile.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("CertificateProfile.description"); value.Exists() { + if value := res.Get("CertificateProfile.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("CertificateProfile.allowedAsUserName"); value.Exists() { + if value := res.Get("CertificateProfile.allowedAsUserName"); value.Exists() && value.Type != gjson.Null { data.AllowedAsUserName = types.BoolValue(value.Bool()) } else { data.AllowedAsUserName = types.BoolValue(false) } - if value := res.Get("CertificateProfile.externalIdentityStoreName"); value.Exists() { + if value := res.Get("CertificateProfile.externalIdentityStoreName"); value.Exists() && value.Type != gjson.Null { data.ExternalIdentityStoreName = types.StringValue(value.String()) } else { data.ExternalIdentityStoreName = types.StringValue("[not applicable]") } - if value := res.Get("CertificateProfile.certificateAttributeName"); value.Exists() { + if value := res.Get("CertificateProfile.certificateAttributeName"); value.Exists() && value.Type != gjson.Null { data.CertificateAttributeName = types.StringValue(value.String()) } else { data.CertificateAttributeName = types.StringValue("SUBJECT_COMMON_NAME") } - if value := res.Get("CertificateProfile.matchMode"); value.Exists() { + if value := res.Get("CertificateProfile.matchMode"); value.Exists() && value.Type != gjson.Null { data.MatchMode = types.StringValue(value.String()) } else { data.MatchMode = types.StringValue("NEVER") } - if value := res.Get("CertificateProfile.usernameFrom"); value.Exists() { + if value := res.Get("CertificateProfile.usernameFrom"); value.Exists() && value.Type != gjson.Null { data.UsernameFrom = types.StringValue(value.String()) } else { data.UsernameFrom = types.StringValue("CERTIFICATE") diff --git a/internal/provider/model_ise_device_admin_authentication_rule.go b/internal/provider/model_ise_device_admin_authentication_rule.go index 6df7e9e..5162567 100644 --- a/internal/provider/model_ise_device_admin_authentication_rule.go +++ b/internal/provider/model_ise_device_admin_authentication_rule.go @@ -212,62 +212,62 @@ func (data DeviceAdminAuthenticationRule) toBody(ctx context.Context, state Devi //template:begin fromBody func (data *DeviceAdminAuthenticationRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -276,42 +276,42 @@ func (data *DeviceAdminAuthenticationRule) fromBody(ctx context.Context, res gjs data.Children = make([]DeviceAdminAuthenticationRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := DeviceAdminAuthenticationRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -320,42 +320,42 @@ func (data *DeviceAdminAuthenticationRule) fromBody(ctx context.Context, res gjs item.Children = make([]DeviceAdminAuthenticationRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := DeviceAdminAuthenticationRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -368,22 +368,22 @@ func (data *DeviceAdminAuthenticationRule) fromBody(ctx context.Context, res gjs return true }) } - if value := res.Get("response.identitySourceName"); value.Exists() { + if value := res.Get("response.identitySourceName"); value.Exists() && value.Type != gjson.Null { data.IdentitySourceName = types.StringValue(value.String()) } else { data.IdentitySourceName = types.StringNull() } - if value := res.Get("response.ifAuthFail"); value.Exists() { + if value := res.Get("response.ifAuthFail"); value.Exists() && value.Type != gjson.Null { data.IfAuthFail = types.StringValue(value.String()) } else { data.IfAuthFail = types.StringNull() } - if value := res.Get("response.ifProcessFail"); value.Exists() { + if value := res.Get("response.ifProcessFail"); value.Exists() && value.Type != gjson.Null { data.IfProcessFail = types.StringValue(value.String()) } else { data.IfProcessFail = types.StringNull() } - if value := res.Get("response.ifUserNotFound"); value.Exists() { + if value := res.Get("response.ifUserNotFound"); value.Exists() && value.Type != gjson.Null { data.IfUserNotFound = types.StringValue(value.String()) } else { data.IfUserNotFound = types.StringNull() diff --git a/internal/provider/model_ise_device_admin_authorization_exception_rule.go b/internal/provider/model_ise_device_admin_authorization_exception_rule.go index 1649dc0..a04b1c5 100644 --- a/internal/provider/model_ise_device_admin_authorization_exception_rule.go +++ b/internal/provider/model_ise_device_admin_authorization_exception_rule.go @@ -207,62 +207,62 @@ func (data DeviceAdminAuthorizationExceptionRule) toBody(ctx context.Context, st //template:begin fromBody func (data *DeviceAdminAuthorizationExceptionRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -271,42 +271,42 @@ func (data *DeviceAdminAuthorizationExceptionRule) fromBody(ctx context.Context, data.Children = make([]DeviceAdminAuthorizationExceptionRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := DeviceAdminAuthorizationExceptionRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -315,42 +315,42 @@ func (data *DeviceAdminAuthorizationExceptionRule) fromBody(ctx context.Context, item.Children = make([]DeviceAdminAuthorizationExceptionRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := DeviceAdminAuthorizationExceptionRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -368,7 +368,7 @@ func (data *DeviceAdminAuthorizationExceptionRule) fromBody(ctx context.Context, } else { data.CommandSets = types.SetNull(types.StringType) } - if value := res.Get("response.profile"); value.Exists() { + if value := res.Get("response.profile"); value.Exists() && value.Type != gjson.Null { data.Profile = types.StringValue(value.String()) } else { data.Profile = types.StringNull() diff --git a/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go b/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go index 9def4cd..0db162f 100644 --- a/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go +++ b/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go @@ -204,62 +204,62 @@ func (data DeviceAdminAuthorizationGlobalExceptionRule) toBody(ctx context.Conte //template:begin fromBody func (data *DeviceAdminAuthorizationGlobalExceptionRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -268,42 +268,42 @@ func (data *DeviceAdminAuthorizationGlobalExceptionRule) fromBody(ctx context.Co data.Children = make([]DeviceAdminAuthorizationGlobalExceptionRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := DeviceAdminAuthorizationGlobalExceptionRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -312,42 +312,42 @@ func (data *DeviceAdminAuthorizationGlobalExceptionRule) fromBody(ctx context.Co item.Children = make([]DeviceAdminAuthorizationGlobalExceptionRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := DeviceAdminAuthorizationGlobalExceptionRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -365,7 +365,7 @@ func (data *DeviceAdminAuthorizationGlobalExceptionRule) fromBody(ctx context.Co } else { data.CommandSets = types.SetNull(types.StringType) } - if value := res.Get("response.profile"); value.Exists() { + if value := res.Get("response.profile"); value.Exists() && value.Type != gjson.Null { data.Profile = types.StringValue(value.String()) } else { data.Profile = types.StringNull() diff --git a/internal/provider/model_ise_device_admin_authorization_rule.go b/internal/provider/model_ise_device_admin_authorization_rule.go index 693d634..46afbff 100644 --- a/internal/provider/model_ise_device_admin_authorization_rule.go +++ b/internal/provider/model_ise_device_admin_authorization_rule.go @@ -207,62 +207,62 @@ func (data DeviceAdminAuthorizationRule) toBody(ctx context.Context, state Devic //template:begin fromBody func (data *DeviceAdminAuthorizationRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -271,42 +271,42 @@ func (data *DeviceAdminAuthorizationRule) fromBody(ctx context.Context, res gjso data.Children = make([]DeviceAdminAuthorizationRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := DeviceAdminAuthorizationRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -315,42 +315,42 @@ func (data *DeviceAdminAuthorizationRule) fromBody(ctx context.Context, res gjso item.Children = make([]DeviceAdminAuthorizationRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := DeviceAdminAuthorizationRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -368,7 +368,7 @@ func (data *DeviceAdminAuthorizationRule) fromBody(ctx context.Context, res gjso } else { data.CommandSets = types.SetNull(types.StringType) } - if value := res.Get("response.profile"); value.Exists() { + if value := res.Get("response.profile"); value.Exists() && value.Type != gjson.Null { data.Profile = types.StringValue(value.String()) } else { data.Profile = types.StringNull() diff --git a/internal/provider/model_ise_device_admin_condition.go b/internal/provider/model_ise_device_admin_condition.go index 5dd2180..48e0346 100644 --- a/internal/provider/model_ise_device_admin_condition.go +++ b/internal/provider/model_ise_device_admin_condition.go @@ -196,47 +196,47 @@ func (data DeviceAdminCondition) toBody(ctx context.Context, state DeviceAdminCo //template:begin fromBody func (data *DeviceAdminCondition) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.description"); value.Exists() { + if value := res.Get("response.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("response.conditionType"); value.Exists() { + if value := res.Get("response.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.isNegate"); value.Exists() { + if value := res.Get("response.isNegate"); value.Exists() && value.Type != gjson.Null { data.IsNegate = types.BoolValue(value.Bool()) } else { data.IsNegate = types.BoolNull() } - if value := res.Get("response.attributeName"); value.Exists() { + if value := res.Get("response.attributeName"); value.Exists() && value.Type != gjson.Null { data.AttributeName = types.StringValue(value.String()) } else { data.AttributeName = types.StringNull() } - if value := res.Get("response.attributeValue"); value.Exists() { + if value := res.Get("response.attributeValue"); value.Exists() && value.Type != gjson.Null { data.AttributeValue = types.StringValue(value.String()) } else { data.AttributeValue = types.StringNull() } - if value := res.Get("response.dictionaryName"); value.Exists() { + if value := res.Get("response.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.DictionaryName = types.StringValue(value.String()) } else { data.DictionaryName = types.StringNull() } - if value := res.Get("response.dictionaryValue"); value.Exists() { + if value := res.Get("response.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.DictionaryValue = types.StringValue(value.String()) } else { data.DictionaryValue = types.StringNull() } - if value := res.Get("response.operator"); value.Exists() { + if value := res.Get("response.operator"); value.Exists() && value.Type != gjson.Null { data.Operator = types.StringValue(value.String()) } else { data.Operator = types.StringNull() @@ -245,52 +245,52 @@ func (data *DeviceAdminCondition) fromBody(ctx context.Context, res gjson.Result data.Children = make([]DeviceAdminConditionChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := DeviceAdminConditionChildren{} - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("description"); cValue.Exists() { + if cValue := v.Get("description"); cValue.Exists() && cValue.Type != gjson.Null { item.Description = types.StringValue(cValue.String()) } else { item.Description = types.StringNull() } - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -299,52 +299,52 @@ func (data *DeviceAdminCondition) fromBody(ctx context.Context, res gjson.Result item.Children = make([]DeviceAdminConditionChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := DeviceAdminConditionChildrenChildren{} - if ccValue := cv.Get("name"); ccValue.Exists() { + if ccValue := cv.Get("name"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Name = types.StringValue(ccValue.String()) } else { cItem.Name = types.StringNull() } - if ccValue := cv.Get("description"); ccValue.Exists() { + if ccValue := cv.Get("description"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Description = types.StringValue(ccValue.String()) } else { cItem.Description = types.StringNull() } - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() diff --git a/internal/provider/model_ise_device_admin_policy_set.go b/internal/provider/model_ise_device_admin_policy_set.go index 23a6386..5d0e057 100644 --- a/internal/provider/model_ise_device_admin_policy_set.go +++ b/internal/provider/model_ise_device_admin_policy_set.go @@ -205,77 +205,77 @@ func (data DeviceAdminPolicySet) toBody(ctx context.Context, state DeviceAdminPo //template:begin fromBody func (data *DeviceAdminPolicySet) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.description"); value.Exists() { + if value := res.Get("response.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("response.isProxy"); value.Exists() { + if value := res.Get("response.isProxy"); value.Exists() && value.Type != gjson.Null { data.IsProxy = types.BoolValue(value.Bool()) } else { data.IsProxy = types.BoolNull() } - if value := res.Get("response.rank"); value.Exists() { + if value := res.Get("response.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.serviceName"); value.Exists() { + if value := res.Get("response.serviceName"); value.Exists() && value.Type != gjson.Null { data.ServiceName = types.StringValue(value.String()) } else { data.ServiceName = types.StringNull() } - if value := res.Get("response.state"); value.Exists() { + if value := res.Get("response.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.default"); value.Exists() { + if value := res.Get("response.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.condition.conditionType"); value.Exists() { + if value := res.Get("response.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.condition.id"); value.Exists() { + if value := res.Get("response.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.condition.isNegate"); value.Exists() { + if value := res.Get("response.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.condition.attributeName"); value.Exists() { + if value := res.Get("response.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.condition.attributeValue"); value.Exists() { + if value := res.Get("response.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.condition.operator"); value.Exists() { + if value := res.Get("response.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -284,42 +284,42 @@ func (data *DeviceAdminPolicySet) fromBody(ctx context.Context, res gjson.Result data.Children = make([]DeviceAdminPolicySetChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := DeviceAdminPolicySetChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -328,42 +328,42 @@ func (data *DeviceAdminPolicySet) fromBody(ctx context.Context, res gjson.Result item.Children = make([]DeviceAdminPolicySetChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := DeviceAdminPolicySetChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() diff --git a/internal/provider/model_ise_device_admin_time_and_date_condition.go b/internal/provider/model_ise_device_admin_time_and_date_condition.go index 1d08258..13f07e5 100644 --- a/internal/provider/model_ise_device_admin_time_and_date_condition.go +++ b/internal/provider/model_ise_device_admin_time_and_date_condition.go @@ -116,17 +116,17 @@ func (data DeviceAdminTimeAndDateCondition) toBody(ctx context.Context, state De //template:begin fromBody func (data *DeviceAdminTimeAndDateCondition) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.description"); value.Exists() { + if value := res.Get("response.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("response.isNegate"); value.Exists() { + if value := res.Get("response.isNegate"); value.Exists() && value.Type != gjson.Null { data.IsNegate = types.BoolValue(value.Bool()) } else { data.IsNegate = types.BoolNull() @@ -141,42 +141,42 @@ func (data *DeviceAdminTimeAndDateCondition) fromBody(ctx context.Context, res g } else { data.WeekDaysException = types.SetNull(types.StringType) } - if value := res.Get("response.datesRange.startDate"); value.Exists() { + if value := res.Get("response.datesRange.startDate"); value.Exists() && value.Type != gjson.Null { data.StartDate = types.StringValue(value.String()) } else { data.StartDate = types.StringNull() } - if value := res.Get("response.datesRange.endDate"); value.Exists() { + if value := res.Get("response.datesRange.endDate"); value.Exists() && value.Type != gjson.Null { data.EndDate = types.StringValue(value.String()) } else { data.EndDate = types.StringNull() } - if value := res.Get("response.datesRangeException.startDate"); value.Exists() { + if value := res.Get("response.datesRangeException.startDate"); value.Exists() && value.Type != gjson.Null { data.ExceptionStartDate = types.StringValue(value.String()) } else { data.ExceptionStartDate = types.StringNull() } - if value := res.Get("response.datesRangeException.endDate"); value.Exists() { + if value := res.Get("response.datesRangeException.endDate"); value.Exists() && value.Type != gjson.Null { data.ExceptionEndDate = types.StringValue(value.String()) } else { data.ExceptionEndDate = types.StringNull() } - if value := res.Get("response.hoursRange.startTime"); value.Exists() { + if value := res.Get("response.hoursRange.startTime"); value.Exists() && value.Type != gjson.Null { data.StartTime = types.StringValue(value.String()) } else { data.StartTime = types.StringNull() } - if value := res.Get("response.hoursRange.endTime"); value.Exists() { + if value := res.Get("response.hoursRange.endTime"); value.Exists() && value.Type != gjson.Null { data.EndTime = types.StringValue(value.String()) } else { data.EndTime = types.StringNull() } - if value := res.Get("response.hoursRangeException.startTime"); value.Exists() { + if value := res.Get("response.hoursRangeException.startTime"); value.Exists() && value.Type != gjson.Null { data.ExceptionStartTime = types.StringValue(value.String()) } else { data.ExceptionStartTime = types.StringNull() } - if value := res.Get("response.hoursRangeException.endTime"); value.Exists() { + if value := res.Get("response.hoursRangeException.endTime"); value.Exists() && value.Type != gjson.Null { data.ExceptionEndTime = types.StringValue(value.String()) } else { data.ExceptionEndTime = types.StringNull() diff --git a/internal/provider/model_ise_downloadable_acl.go b/internal/provider/model_ise_downloadable_acl.go index 3a7ebcc..0c949ba 100644 --- a/internal/provider/model_ise_downloadable_acl.go +++ b/internal/provider/model_ise_downloadable_acl.go @@ -74,22 +74,22 @@ func (data DownloadableACL) toBody(ctx context.Context, state DownloadableACL) s //template:begin fromBody func (data *DownloadableACL) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("DownloadableAcl.name"); value.Exists() { + if value := res.Get("DownloadableAcl.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("DownloadableAcl.description"); value.Exists() { + if value := res.Get("DownloadableAcl.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("DownloadableAcl.dacl"); value.Exists() { + if value := res.Get("DownloadableAcl.dacl"); value.Exists() && value.Type != gjson.Null { data.Dacl = types.StringValue(value.String()) } else { data.Dacl = types.StringNull() } - if value := res.Get("DownloadableAcl.daclType"); value.Exists() { + if value := res.Get("DownloadableAcl.daclType"); value.Exists() && value.Type != gjson.Null { data.DaclType = types.StringValue(value.String()) } else { data.DaclType = types.StringValue("IPV4") diff --git a/internal/provider/model_ise_endpoint.go b/internal/provider/model_ise_endpoint.go index ecfdaff..31d4e90 100644 --- a/internal/provider/model_ise_endpoint.go +++ b/internal/provider/model_ise_endpoint.go @@ -165,47 +165,47 @@ func (data Endpoint) toBody(ctx context.Context, state Endpoint) string { //template:begin fromBody func (data *Endpoint) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("ERSEndPoint.name"); value.Exists() { + if value := res.Get("ERSEndPoint.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("ERSEndPoint.description"); value.Exists() { + if value := res.Get("ERSEndPoint.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("ERSEndPoint.mac"); value.Exists() { + if value := res.Get("ERSEndPoint.mac"); value.Exists() && value.Type != gjson.Null { data.Mac = types.StringValue(value.String()) } else { data.Mac = types.StringNull() } - if value := res.Get("ERSEndPoint.groupId"); value.Exists() { + if value := res.Get("ERSEndPoint.groupId"); value.Exists() && value.Type != gjson.Null { data.GroupId = types.StringValue(value.String()) } else { data.GroupId = types.StringNull() } - if value := res.Get("ERSEndPoint.profileId"); value.Exists() { + if value := res.Get("ERSEndPoint.profileId"); value.Exists() && value.Type != gjson.Null { data.ProfileId = types.StringValue(value.String()) } else { data.ProfileId = types.StringNull() } - if value := res.Get("ERSEndPoint.staticProfileAssignment"); value.Exists() { + if value := res.Get("ERSEndPoint.staticProfileAssignment"); value.Exists() && value.Type != gjson.Null { data.StaticProfileAssignment = types.BoolValue(value.Bool()) } else { data.StaticProfileAssignment = types.BoolNull() } - if value := res.Get("ERSEndPoint.staticProfileAssignmentDefined"); value.Exists() { + if value := res.Get("ERSEndPoint.staticProfileAssignmentDefined"); value.Exists() && value.Type != gjson.Null { data.StaticProfileAssignmentDefined = types.BoolValue(value.Bool()) } else { data.StaticProfileAssignmentDefined = types.BoolValue(true) } - if value := res.Get("ERSEndPoint.staticGroupAssignment"); value.Exists() { + if value := res.Get("ERSEndPoint.staticGroupAssignment"); value.Exists() && value.Type != gjson.Null { data.StaticGroupAssignment = types.BoolValue(value.Bool()) } else { data.StaticGroupAssignment = types.BoolNull() } - if value := res.Get("ERSEndPoint.staticGroupAssignmentDefined"); value.Exists() { + if value := res.Get("ERSEndPoint.staticGroupAssignmentDefined"); value.Exists() && value.Type != gjson.Null { data.StaticGroupAssignmentDefined = types.BoolValue(value.Bool()) } else { data.StaticGroupAssignmentDefined = types.BoolValue(true) @@ -215,82 +215,82 @@ func (data *Endpoint) fromBody(ctx context.Context, res gjson.Result) { } else { data.CustomAttributes = types.MapNull(types.StringType) } - if value := res.Get("ERSEndPoint.identityStore"); value.Exists() { + if value := res.Get("ERSEndPoint.identityStore"); value.Exists() && value.Type != gjson.Null { data.IdentityStore = types.StringValue(value.String()) } else { data.IdentityStore = types.StringNull() } - if value := res.Get("ERSEndPoint.identityStoreId"); value.Exists() { + if value := res.Get("ERSEndPoint.identityStoreId"); value.Exists() && value.Type != gjson.Null { data.IdentityStoreId = types.StringValue(value.String()) } else { data.IdentityStoreId = types.StringNull() } - if value := res.Get("ERSEndPoint.portalUser"); value.Exists() { + if value := res.Get("ERSEndPoint.portalUser"); value.Exists() && value.Type != gjson.Null { data.PortalUser = types.StringValue(value.String()) } else { data.PortalUser = types.StringNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmServerName"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmServerName"); value.Exists() && value.Type != gjson.Null { data.MdmServerName = types.StringValue(value.String()) } else { data.MdmServerName = types.StringNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmReachable"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmReachable"); value.Exists() && value.Type != gjson.Null { data.MdmReachable = types.BoolValue(value.Bool()) } else { data.MdmReachable = types.BoolNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmEnrolled"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmEnrolled"); value.Exists() && value.Type != gjson.Null { data.MdmEnrolled = types.BoolValue(value.Bool()) } else { data.MdmEnrolled = types.BoolNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmComplianceStatus"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmComplianceStatus"); value.Exists() && value.Type != gjson.Null { data.MdmComplianceStatus = types.BoolValue(value.Bool()) } else { data.MdmComplianceStatus = types.BoolNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmOS"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmOS"); value.Exists() && value.Type != gjson.Null { data.MdmOs = types.StringValue(value.String()) } else { data.MdmOs = types.StringNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmManufacturer"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmManufacturer"); value.Exists() && value.Type != gjson.Null { data.MdmManufacturer = types.StringValue(value.String()) } else { data.MdmManufacturer = types.StringNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmModel"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmModel"); value.Exists() && value.Type != gjson.Null { data.MdmModel = types.StringValue(value.String()) } else { data.MdmModel = types.StringNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmSerial"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmSerial"); value.Exists() && value.Type != gjson.Null { data.MdmSerial = types.StringValue(value.String()) } else { data.MdmSerial = types.StringNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmEncrypted"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmEncrypted"); value.Exists() && value.Type != gjson.Null { data.MdmEncrypted = types.BoolValue(value.Bool()) } else { data.MdmEncrypted = types.BoolNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmPinlock"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmPinlock"); value.Exists() && value.Type != gjson.Null { data.MdmPinlock = types.BoolValue(value.Bool()) } else { data.MdmPinlock = types.BoolNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmJailBroken"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmJailBroken"); value.Exists() && value.Type != gjson.Null { data.MdmJailBroken = types.BoolValue(value.Bool()) } else { data.MdmJailBroken = types.BoolNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmIMEI"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmIMEI"); value.Exists() && value.Type != gjson.Null { data.MdmImei = types.StringValue(value.String()) } else { data.MdmImei = types.StringNull() } - if value := res.Get("ERSEndPoint.mdmAttributes.mdmPhoneNumber"); value.Exists() { + if value := res.Get("ERSEndPoint.mdmAttributes.mdmPhoneNumber"); value.Exists() && value.Type != gjson.Null { data.MdmPhoneNumber = types.StringValue(value.String()) } else { data.MdmPhoneNumber = types.StringNull() diff --git a/internal/provider/model_ise_endpoint_identity_group.go b/internal/provider/model_ise_endpoint_identity_group.go index 0087e63..8518086 100644 --- a/internal/provider/model_ise_endpoint_identity_group.go +++ b/internal/provider/model_ise_endpoint_identity_group.go @@ -74,22 +74,22 @@ func (data EndpointIdentityGroup) toBody(ctx context.Context, state EndpointIden //template:begin fromBody func (data *EndpointIdentityGroup) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("EndPointGroup.name"); value.Exists() { + if value := res.Get("EndPointGroup.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("EndPointGroup.description"); value.Exists() { + if value := res.Get("EndPointGroup.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("EndPointGroup.systemDefined"); value.Exists() { + if value := res.Get("EndPointGroup.systemDefined"); value.Exists() && value.Type != gjson.Null { data.SystemDefined = types.BoolValue(value.Bool()) } else { data.SystemDefined = types.BoolValue(false) } - if value := res.Get("EndPointGroup.parentId"); value.Exists() { + if value := res.Get("EndPointGroup.parentId"); value.Exists() && value.Type != gjson.Null { data.ParentEndpointIdentityGroupId = types.StringValue(value.String()) } else { data.ParentEndpointIdentityGroupId = types.StringNull() diff --git a/internal/provider/model_ise_identity_source_sequence.go b/internal/provider/model_ise_identity_source_sequence.go index d569357..5dd1e14 100644 --- a/internal/provider/model_ise_identity_source_sequence.go +++ b/internal/provider/model_ise_identity_source_sequence.go @@ -94,22 +94,22 @@ func (data IdentitySourceSequence) toBody(ctx context.Context, state IdentitySou //template:begin fromBody func (data *IdentitySourceSequence) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("IdStoreSequence.name"); value.Exists() { + if value := res.Get("IdStoreSequence.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("IdStoreSequence.description"); value.Exists() { + if value := res.Get("IdStoreSequence.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("IdStoreSequence.breakOnStoreFail"); value.Exists() { + if value := res.Get("IdStoreSequence.breakOnStoreFail"); value.Exists() && value.Type != gjson.Null { data.BreakOnStoreFail = types.BoolValue(value.Bool()) } else { data.BreakOnStoreFail = types.BoolNull() } - if value := res.Get("IdStoreSequence.certificateAuthenticationProfile"); value.Exists() { + if value := res.Get("IdStoreSequence.certificateAuthenticationProfile"); value.Exists() && value.Type != gjson.Null { data.CertificateAuthenticationProfile = types.StringValue(value.String()) } else { data.CertificateAuthenticationProfile = types.StringNull() @@ -118,12 +118,12 @@ func (data *IdentitySourceSequence) fromBody(ctx context.Context, res gjson.Resu data.IdentitySources = make([]IdentitySourceSequenceIdentitySources, 0) value.ForEach(func(k, v gjson.Result) bool { item := IdentitySourceSequenceIdentitySources{} - if cValue := v.Get("idstore"); cValue.Exists() { + if cValue := v.Get("idstore"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("order"); cValue.Exists() { + if cValue := v.Get("order"); cValue.Exists() && cValue.Type != gjson.Null { item.Order = types.Int64Value(cValue.Int()) } else { item.Order = types.Int64Null() diff --git a/internal/provider/model_ise_internal_user.go b/internal/provider/model_ise_internal_user.go index 2a0f087..9358f15 100644 --- a/internal/provider/model_ise_internal_user.go +++ b/internal/provider/model_ise_internal_user.go @@ -114,62 +114,62 @@ func (data InternalUser) toBody(ctx context.Context, state InternalUser) string //template:begin fromBody func (data *InternalUser) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("InternalUser.name"); value.Exists() { + if value := res.Get("InternalUser.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("InternalUser.changePassword"); value.Exists() { + if value := res.Get("InternalUser.changePassword"); value.Exists() && value.Type != gjson.Null { data.ChangePassword = types.BoolValue(value.Bool()) } else { data.ChangePassword = types.BoolValue(true) } - if value := res.Get("InternalUser.email"); value.Exists() { + if value := res.Get("InternalUser.email"); value.Exists() && value.Type != gjson.Null { data.Email = types.StringValue(value.String()) } else { data.Email = types.StringNull() } - if value := res.Get("InternalUser.accountNameAlias"); value.Exists() { + if value := res.Get("InternalUser.accountNameAlias"); value.Exists() && value.Type != gjson.Null { data.AccountNameAlias = types.StringValue(value.String()) } else { data.AccountNameAlias = types.StringNull() } - if value := res.Get("InternalUser.enabled"); value.Exists() { + if value := res.Get("InternalUser.enabled"); value.Exists() && value.Type != gjson.Null { data.Enabled = types.BoolValue(value.Bool()) } else { data.Enabled = types.BoolNull() } - if value := res.Get("InternalUser.passwordNeverExpires"); value.Exists() { + if value := res.Get("InternalUser.passwordNeverExpires"); value.Exists() && value.Type != gjson.Null { data.PasswordNeverExpires = types.BoolValue(value.Bool()) } else { data.PasswordNeverExpires = types.BoolValue(false) } - if value := res.Get("InternalUser.firstName"); value.Exists() { + if value := res.Get("InternalUser.firstName"); value.Exists() && value.Type != gjson.Null { data.FirstName = types.StringValue(value.String()) } else { data.FirstName = types.StringNull() } - if value := res.Get("InternalUser.lastName"); value.Exists() { + if value := res.Get("InternalUser.lastName"); value.Exists() && value.Type != gjson.Null { data.LastName = types.StringValue(value.String()) } else { data.LastName = types.StringNull() } - if value := res.Get("InternalUser.identityGroups"); value.Exists() { + if value := res.Get("InternalUser.identityGroups"); value.Exists() && value.Type != gjson.Null { data.IdentityGroups = types.StringValue(value.String()) } else { data.IdentityGroups = types.StringNull() } - if value := res.Get("InternalUser.customAttributes"); value.Exists() { + if value := res.Get("InternalUser.customAttributes"); value.Exists() && value.Type != gjson.Null { data.CustomAttributes = types.StringValue(value.String()) } else { data.CustomAttributes = types.StringNull() } - if value := res.Get("InternalUser.passwordIDStore"); value.Exists() { + if value := res.Get("InternalUser.passwordIDStore"); value.Exists() && value.Type != gjson.Null { data.PasswordIdStore = types.StringValue(value.String()) } else { data.PasswordIdStore = types.StringValue("Internal Users") } - if value := res.Get("InternalUser.description"); value.Exists() { + if value := res.Get("InternalUser.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() diff --git a/internal/provider/model_ise_license_tier_state.go b/internal/provider/model_ise_license_tier_state.go index 47d0033..d58999c 100644 --- a/internal/provider/model_ise_license_tier_state.go +++ b/internal/provider/model_ise_license_tier_state.go @@ -81,12 +81,12 @@ func (data *LicenseTierState) fromBody(ctx context.Context, res gjson.Result) { data.Licenses = make([]LicenseTierStateLicenses, 0) value.ForEach(func(k, v gjson.Result) bool { item := LicenseTierStateLicenses{} - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("status"); cValue.Exists() { + if cValue := v.Get("status"); cValue.Exists() && cValue.Type != gjson.Null { item.Status = types.StringValue(cValue.String()) } else { item.Status = types.StringNull() diff --git a/internal/provider/model_ise_network_access_authentication_rule.go b/internal/provider/model_ise_network_access_authentication_rule.go index e79233c..cc83ff8 100644 --- a/internal/provider/model_ise_network_access_authentication_rule.go +++ b/internal/provider/model_ise_network_access_authentication_rule.go @@ -212,62 +212,62 @@ func (data NetworkAccessAuthenticationRule) toBody(ctx context.Context, state Ne //template:begin fromBody func (data *NetworkAccessAuthenticationRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -276,42 +276,42 @@ func (data *NetworkAccessAuthenticationRule) fromBody(ctx context.Context, res g data.Children = make([]NetworkAccessAuthenticationRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := NetworkAccessAuthenticationRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -320,42 +320,42 @@ func (data *NetworkAccessAuthenticationRule) fromBody(ctx context.Context, res g item.Children = make([]NetworkAccessAuthenticationRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := NetworkAccessAuthenticationRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -368,22 +368,22 @@ func (data *NetworkAccessAuthenticationRule) fromBody(ctx context.Context, res g return true }) } - if value := res.Get("response.identitySourceName"); value.Exists() { + if value := res.Get("response.identitySourceName"); value.Exists() && value.Type != gjson.Null { data.IdentitySourceName = types.StringValue(value.String()) } else { data.IdentitySourceName = types.StringNull() } - if value := res.Get("response.ifAuthFail"); value.Exists() { + if value := res.Get("response.ifAuthFail"); value.Exists() && value.Type != gjson.Null { data.IfAuthFail = types.StringValue(value.String()) } else { data.IfAuthFail = types.StringNull() } - if value := res.Get("response.ifProcessFail"); value.Exists() { + if value := res.Get("response.ifProcessFail"); value.Exists() && value.Type != gjson.Null { data.IfProcessFail = types.StringValue(value.String()) } else { data.IfProcessFail = types.StringNull() } - if value := res.Get("response.ifUserNotFound"); value.Exists() { + if value := res.Get("response.ifUserNotFound"); value.Exists() && value.Type != gjson.Null { data.IfUserNotFound = types.StringValue(value.String()) } else { data.IfUserNotFound = types.StringNull() diff --git a/internal/provider/model_ise_network_access_authentication_rule_update_rank.go b/internal/provider/model_ise_network_access_authentication_rule_update_rank.go new file mode 100644 index 0000000..e9338d5 --- /dev/null +++ b/internal/provider/model_ise_network_access_authentication_rule_update_rank.go @@ -0,0 +1,103 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +//template:begin imports +import ( + "context" + "fmt" + "net/url" + + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +//template:end imports + +//template:begin types +type NetworkAccessAuthenticationRuleUpdateRank struct { + Id types.String `tfsdk:"id"` + AuthRuleId types.String `tfsdk:"auth_rule_id"` + PolicySetId types.String `tfsdk:"policy_set_id"` + Rank types.Int64 `tfsdk:"rank"` +} + +//template:end types + +//template:begin getPath +func (data NetworkAccessAuthenticationRuleUpdateRank) getPath() string { + return fmt.Sprintf("/api/v1/policy/network-access/policy-set/%v/authentication", url.QueryEscape(data.PolicySetId.ValueString())) +} + +//template:end getPath + +//template:begin getPathDelete + +//template:end getPathDelete + +//template:begin toBody +func (data NetworkAccessAuthenticationRuleUpdateRank) toBody(ctx context.Context, state NetworkAccessAuthenticationRuleUpdateRank) string { + body := "" + if !data.AuthRuleId.IsNull() { + body, _ = sjson.Set(body, "", data.AuthRuleId.ValueString()) + } + if !data.Rank.IsNull() { + body, _ = sjson.Set(body, "rule.rank", data.Rank.ValueInt64()) + } + return body +} + +//template:end toBody + +//template:begin fromBody +func (data *NetworkAccessAuthenticationRuleUpdateRank) fromBody(ctx context.Context, res gjson.Result) { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { + data.Rank = types.Int64Value(value.Int()) + } else { + data.Rank = types.Int64Null() + } +} + +//template:end fromBody + +//template:begin updateFromBody +func (data *NetworkAccessAuthenticationRuleUpdateRank) updateFromBody(ctx context.Context, res gjson.Result) { + if value := res.Get("response.rule.rank"); value.Exists() && !data.Rank.IsNull() { + data.Rank = types.Int64Value(value.Int()) + } else { + data.Rank = types.Int64Null() + } +} + +//template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessAuthenticationRuleUpdateRank) isNull(ctx context.Context, res gjson.Result) bool { + if !data.AuthRuleId.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_authorization_exception_rule.go b/internal/provider/model_ise_network_access_authorization_exception_rule.go index edea842..bff4834 100644 --- a/internal/provider/model_ise_network_access_authorization_exception_rule.go +++ b/internal/provider/model_ise_network_access_authorization_exception_rule.go @@ -207,62 +207,62 @@ func (data NetworkAccessAuthorizationExceptionRule) toBody(ctx context.Context, //template:begin fromBody func (data *NetworkAccessAuthorizationExceptionRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -271,42 +271,42 @@ func (data *NetworkAccessAuthorizationExceptionRule) fromBody(ctx context.Contex data.Children = make([]NetworkAccessAuthorizationExceptionRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := NetworkAccessAuthorizationExceptionRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -315,42 +315,42 @@ func (data *NetworkAccessAuthorizationExceptionRule) fromBody(ctx context.Contex item.Children = make([]NetworkAccessAuthorizationExceptionRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := NetworkAccessAuthorizationExceptionRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -368,7 +368,7 @@ func (data *NetworkAccessAuthorizationExceptionRule) fromBody(ctx context.Contex } else { data.Profiles = types.SetNull(types.StringType) } - if value := res.Get("response.securityGroup"); value.Exists() { + if value := res.Get("response.securityGroup"); value.Exists() && value.Type != gjson.Null { data.SecurityGroup = types.StringValue(value.String()) } else { data.SecurityGroup = types.StringNull() diff --git a/internal/provider/model_ise_network_access_authorization_global_exception_rule.go b/internal/provider/model_ise_network_access_authorization_global_exception_rule.go index d7b6716..d511478 100644 --- a/internal/provider/model_ise_network_access_authorization_global_exception_rule.go +++ b/internal/provider/model_ise_network_access_authorization_global_exception_rule.go @@ -204,62 +204,62 @@ func (data NetworkAccessAuthorizationGlobalExceptionRule) toBody(ctx context.Con //template:begin fromBody func (data *NetworkAccessAuthorizationGlobalExceptionRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -268,42 +268,42 @@ func (data *NetworkAccessAuthorizationGlobalExceptionRule) fromBody(ctx context. data.Children = make([]NetworkAccessAuthorizationGlobalExceptionRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := NetworkAccessAuthorizationGlobalExceptionRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -312,42 +312,42 @@ func (data *NetworkAccessAuthorizationGlobalExceptionRule) fromBody(ctx context. item.Children = make([]NetworkAccessAuthorizationGlobalExceptionRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := NetworkAccessAuthorizationGlobalExceptionRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -365,7 +365,7 @@ func (data *NetworkAccessAuthorizationGlobalExceptionRule) fromBody(ctx context. } else { data.Profiles = types.SetNull(types.StringType) } - if value := res.Get("response.securityGroup"); value.Exists() { + if value := res.Get("response.securityGroup"); value.Exists() && value.Type != gjson.Null { data.SecurityGroup = types.StringValue(value.String()) } else { data.SecurityGroup = types.StringNull() diff --git a/internal/provider/model_ise_network_access_authorization_rule.go b/internal/provider/model_ise_network_access_authorization_rule.go index 65d7890..65dc94e 100644 --- a/internal/provider/model_ise_network_access_authorization_rule.go +++ b/internal/provider/model_ise_network_access_authorization_rule.go @@ -207,62 +207,62 @@ func (data NetworkAccessAuthorizationRule) toBody(ctx context.Context, state Net //template:begin fromBody func (data *NetworkAccessAuthorizationRule) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.rule.name"); value.Exists() { + if value := res.Get("response.rule.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.rule.default"); value.Exists() { + if value := res.Get("response.rule.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.rule.rank"); value.Exists() { + if value := res.Get("response.rule.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.rule.state"); value.Exists() { + if value := res.Get("response.rule.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.rule.condition.conditionType"); value.Exists() { + if value := res.Get("response.rule.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.rule.condition.id"); value.Exists() { + if value := res.Get("response.rule.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.rule.condition.isNegate"); value.Exists() { + if value := res.Get("response.rule.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.rule.condition.attributeName"); value.Exists() { + if value := res.Get("response.rule.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.rule.condition.attributeValue"); value.Exists() { + if value := res.Get("response.rule.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.rule.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.rule.condition.operator"); value.Exists() { + if value := res.Get("response.rule.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -271,42 +271,42 @@ func (data *NetworkAccessAuthorizationRule) fromBody(ctx context.Context, res gj data.Children = make([]NetworkAccessAuthorizationRuleChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := NetworkAccessAuthorizationRuleChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -315,42 +315,42 @@ func (data *NetworkAccessAuthorizationRule) fromBody(ctx context.Context, res gj item.Children = make([]NetworkAccessAuthorizationRuleChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := NetworkAccessAuthorizationRuleChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() @@ -368,7 +368,7 @@ func (data *NetworkAccessAuthorizationRule) fromBody(ctx context.Context, res gj } else { data.Profiles = types.SetNull(types.StringType) } - if value := res.Get("response.securityGroup"); value.Exists() { + if value := res.Get("response.securityGroup"); value.Exists() && value.Type != gjson.Null { data.SecurityGroup = types.StringValue(value.String()) } else { data.SecurityGroup = types.StringNull() diff --git a/internal/provider/model_ise_network_access_condition.go b/internal/provider/model_ise_network_access_condition.go index c1729f6..d369e55 100644 --- a/internal/provider/model_ise_network_access_condition.go +++ b/internal/provider/model_ise_network_access_condition.go @@ -196,47 +196,47 @@ func (data NetworkAccessCondition) toBody(ctx context.Context, state NetworkAcce //template:begin fromBody func (data *NetworkAccessCondition) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.description"); value.Exists() { + if value := res.Get("response.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("response.conditionType"); value.Exists() { + if value := res.Get("response.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.isNegate"); value.Exists() { + if value := res.Get("response.isNegate"); value.Exists() && value.Type != gjson.Null { data.IsNegate = types.BoolValue(value.Bool()) } else { data.IsNegate = types.BoolNull() } - if value := res.Get("response.attributeName"); value.Exists() { + if value := res.Get("response.attributeName"); value.Exists() && value.Type != gjson.Null { data.AttributeName = types.StringValue(value.String()) } else { data.AttributeName = types.StringNull() } - if value := res.Get("response.attributeValue"); value.Exists() { + if value := res.Get("response.attributeValue"); value.Exists() && value.Type != gjson.Null { data.AttributeValue = types.StringValue(value.String()) } else { data.AttributeValue = types.StringNull() } - if value := res.Get("response.dictionaryName"); value.Exists() { + if value := res.Get("response.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.DictionaryName = types.StringValue(value.String()) } else { data.DictionaryName = types.StringNull() } - if value := res.Get("response.dictionaryValue"); value.Exists() { + if value := res.Get("response.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.DictionaryValue = types.StringValue(value.String()) } else { data.DictionaryValue = types.StringNull() } - if value := res.Get("response.operator"); value.Exists() { + if value := res.Get("response.operator"); value.Exists() && value.Type != gjson.Null { data.Operator = types.StringValue(value.String()) } else { data.Operator = types.StringNull() @@ -245,52 +245,52 @@ func (data *NetworkAccessCondition) fromBody(ctx context.Context, res gjson.Resu data.Children = make([]NetworkAccessConditionChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := NetworkAccessConditionChildren{} - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("description"); cValue.Exists() { + if cValue := v.Get("description"); cValue.Exists() && cValue.Type != gjson.Null { item.Description = types.StringValue(cValue.String()) } else { item.Description = types.StringNull() } - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -299,52 +299,52 @@ func (data *NetworkAccessCondition) fromBody(ctx context.Context, res gjson.Resu item.Children = make([]NetworkAccessConditionChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := NetworkAccessConditionChildrenChildren{} - if ccValue := cv.Get("name"); ccValue.Exists() { + if ccValue := cv.Get("name"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Name = types.StringValue(ccValue.String()) } else { cItem.Name = types.StringNull() } - if ccValue := cv.Get("description"); ccValue.Exists() { + if ccValue := cv.Get("description"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Description = types.StringValue(ccValue.String()) } else { cItem.Description = types.StringNull() } - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() diff --git a/internal/provider/model_ise_network_access_dictionary.go b/internal/provider/model_ise_network_access_dictionary.go index 48f3bf1..8e6cc93 100644 --- a/internal/provider/model_ise_network_access_dictionary.go +++ b/internal/provider/model_ise_network_access_dictionary.go @@ -74,22 +74,22 @@ func (data NetworkAccessDictionary) toBody(ctx context.Context, state NetworkAcc //template:begin fromBody func (data *NetworkAccessDictionary) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.description"); value.Exists() { + if value := res.Get("response.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("response.version"); value.Exists() { + if value := res.Get("response.version"); value.Exists() && value.Type != gjson.Null { data.Version = types.StringValue(value.String()) } else { data.Version = types.StringNull() } - if value := res.Get("response.dictionaryAttrType"); value.Exists() { + if value := res.Get("response.dictionaryAttrType"); value.Exists() && value.Type != gjson.Null { data.DictionaryAttrType = types.StringValue(value.String()) } else { data.DictionaryAttrType = types.StringNull() diff --git a/internal/provider/model_ise_network_access_policy_set.go b/internal/provider/model_ise_network_access_policy_set.go index f0eb29d..c8d044b 100644 --- a/internal/provider/model_ise_network_access_policy_set.go +++ b/internal/provider/model_ise_network_access_policy_set.go @@ -205,77 +205,77 @@ func (data NetworkAccessPolicySet) toBody(ctx context.Context, state NetworkAcce //template:begin fromBody func (data *NetworkAccessPolicySet) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.description"); value.Exists() { + if value := res.Get("response.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("response.isProxy"); value.Exists() { + if value := res.Get("response.isProxy"); value.Exists() && value.Type != gjson.Null { data.IsProxy = types.BoolValue(value.Bool()) } else { data.IsProxy = types.BoolNull() } - if value := res.Get("response.rank"); value.Exists() { + if value := res.Get("response.rank"); value.Exists() && value.Type != gjson.Null { data.Rank = types.Int64Value(value.Int()) } else { data.Rank = types.Int64Null() } - if value := res.Get("response.serviceName"); value.Exists() { + if value := res.Get("response.serviceName"); value.Exists() && value.Type != gjson.Null { data.ServiceName = types.StringValue(value.String()) } else { data.ServiceName = types.StringNull() } - if value := res.Get("response.state"); value.Exists() { + if value := res.Get("response.state"); value.Exists() && value.Type != gjson.Null { data.State = types.StringValue(value.String()) } else { data.State = types.StringNull() } - if value := res.Get("response.default"); value.Exists() { + if value := res.Get("response.default"); value.Exists() && value.Type != gjson.Null { data.Default = types.BoolValue(value.Bool()) } else { data.Default = types.BoolNull() } - if value := res.Get("response.condition.conditionType"); value.Exists() { + if value := res.Get("response.condition.conditionType"); value.Exists() && value.Type != gjson.Null { data.ConditionType = types.StringValue(value.String()) } else { data.ConditionType = types.StringNull() } - if value := res.Get("response.condition.id"); value.Exists() { + if value := res.Get("response.condition.id"); value.Exists() && value.Type != gjson.Null { data.ConditionId = types.StringValue(value.String()) } else { data.ConditionId = types.StringNull() } - if value := res.Get("response.condition.isNegate"); value.Exists() { + if value := res.Get("response.condition.isNegate"); value.Exists() && value.Type != gjson.Null { data.ConditionIsNegate = types.BoolValue(value.Bool()) } else { data.ConditionIsNegate = types.BoolNull() } - if value := res.Get("response.condition.attributeName"); value.Exists() { + if value := res.Get("response.condition.attributeName"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeName = types.StringValue(value.String()) } else { data.ConditionAttributeName = types.StringNull() } - if value := res.Get("response.condition.attributeValue"); value.Exists() { + if value := res.Get("response.condition.attributeValue"); value.Exists() && value.Type != gjson.Null { data.ConditionAttributeValue = types.StringValue(value.String()) } else { data.ConditionAttributeValue = types.StringNull() } - if value := res.Get("response.condition.dictionaryName"); value.Exists() { + if value := res.Get("response.condition.dictionaryName"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryName = types.StringValue(value.String()) } else { data.ConditionDictionaryName = types.StringNull() } - if value := res.Get("response.condition.dictionaryValue"); value.Exists() { + if value := res.Get("response.condition.dictionaryValue"); value.Exists() && value.Type != gjson.Null { data.ConditionDictionaryValue = types.StringValue(value.String()) } else { data.ConditionDictionaryValue = types.StringNull() } - if value := res.Get("response.condition.operator"); value.Exists() { + if value := res.Get("response.condition.operator"); value.Exists() && value.Type != gjson.Null { data.ConditionOperator = types.StringValue(value.String()) } else { data.ConditionOperator = types.StringNull() @@ -284,42 +284,42 @@ func (data *NetworkAccessPolicySet) fromBody(ctx context.Context, res gjson.Resu data.Children = make([]NetworkAccessPolicySetChildren, 0) value.ForEach(func(k, v gjson.Result) bool { item := NetworkAccessPolicySetChildren{} - if cValue := v.Get("conditionType"); cValue.Exists() { + if cValue := v.Get("conditionType"); cValue.Exists() && cValue.Type != gjson.Null { item.ConditionType = types.StringValue(cValue.String()) } else { item.ConditionType = types.StringNull() } - if cValue := v.Get("id"); cValue.Exists() { + if cValue := v.Get("id"); cValue.Exists() && cValue.Type != gjson.Null { item.Id = types.StringValue(cValue.String()) } else { item.Id = types.StringNull() } - if cValue := v.Get("isNegate"); cValue.Exists() { + if cValue := v.Get("isNegate"); cValue.Exists() && cValue.Type != gjson.Null { item.IsNegate = types.BoolValue(cValue.Bool()) } else { item.IsNegate = types.BoolNull() } - if cValue := v.Get("attributeName"); cValue.Exists() { + if cValue := v.Get("attributeName"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeName = types.StringValue(cValue.String()) } else { item.AttributeName = types.StringNull() } - if cValue := v.Get("attributeValue"); cValue.Exists() { + if cValue := v.Get("attributeValue"); cValue.Exists() && cValue.Type != gjson.Null { item.AttributeValue = types.StringValue(cValue.String()) } else { item.AttributeValue = types.StringNull() } - if cValue := v.Get("dictionaryName"); cValue.Exists() { + if cValue := v.Get("dictionaryName"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryName = types.StringValue(cValue.String()) } else { item.DictionaryName = types.StringNull() } - if cValue := v.Get("dictionaryValue"); cValue.Exists() { + if cValue := v.Get("dictionaryValue"); cValue.Exists() && cValue.Type != gjson.Null { item.DictionaryValue = types.StringValue(cValue.String()) } else { item.DictionaryValue = types.StringNull() } - if cValue := v.Get("operator"); cValue.Exists() { + if cValue := v.Get("operator"); cValue.Exists() && cValue.Type != gjson.Null { item.Operator = types.StringValue(cValue.String()) } else { item.Operator = types.StringNull() @@ -328,42 +328,42 @@ func (data *NetworkAccessPolicySet) fromBody(ctx context.Context, res gjson.Resu item.Children = make([]NetworkAccessPolicySetChildrenChildren, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { cItem := NetworkAccessPolicySetChildrenChildren{} - if ccValue := cv.Get("conditionType"); ccValue.Exists() { + if ccValue := cv.Get("conditionType"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.ConditionType = types.StringValue(ccValue.String()) } else { cItem.ConditionType = types.StringNull() } - if ccValue := cv.Get("id"); ccValue.Exists() { + if ccValue := cv.Get("id"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Id = types.StringValue(ccValue.String()) } else { cItem.Id = types.StringNull() } - if ccValue := cv.Get("isNegate"); ccValue.Exists() { + if ccValue := cv.Get("isNegate"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.IsNegate = types.BoolValue(ccValue.Bool()) } else { cItem.IsNegate = types.BoolNull() } - if ccValue := cv.Get("attributeName"); ccValue.Exists() { + if ccValue := cv.Get("attributeName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeName = types.StringValue(ccValue.String()) } else { cItem.AttributeName = types.StringNull() } - if ccValue := cv.Get("attributeValue"); ccValue.Exists() { + if ccValue := cv.Get("attributeValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.AttributeValue = types.StringValue(ccValue.String()) } else { cItem.AttributeValue = types.StringNull() } - if ccValue := cv.Get("dictionaryName"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryName"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryName = types.StringValue(ccValue.String()) } else { cItem.DictionaryName = types.StringNull() } - if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() { + if ccValue := cv.Get("dictionaryValue"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.DictionaryValue = types.StringValue(ccValue.String()) } else { cItem.DictionaryValue = types.StringNull() } - if ccValue := cv.Get("operator"); ccValue.Exists() { + if ccValue := cv.Get("operator"); ccValue.Exists() && ccValue.Type != gjson.Null { cItem.Operator = types.StringValue(ccValue.String()) } else { cItem.Operator = types.StringNull() diff --git a/internal/provider/model_ise_network_access_time_and_date_condition.go b/internal/provider/model_ise_network_access_time_and_date_condition.go index 99a57dd..01ede28 100644 --- a/internal/provider/model_ise_network_access_time_and_date_condition.go +++ b/internal/provider/model_ise_network_access_time_and_date_condition.go @@ -116,17 +116,17 @@ func (data NetworkAccessTimeAndDateCondition) toBody(ctx context.Context, state //template:begin fromBody func (data *NetworkAccessTimeAndDateCondition) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.description"); value.Exists() { + if value := res.Get("response.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("response.isNegate"); value.Exists() { + if value := res.Get("response.isNegate"); value.Exists() && value.Type != gjson.Null { data.IsNegate = types.BoolValue(value.Bool()) } else { data.IsNegate = types.BoolNull() @@ -141,42 +141,42 @@ func (data *NetworkAccessTimeAndDateCondition) fromBody(ctx context.Context, res } else { data.WeekDaysException = types.SetNull(types.StringType) } - if value := res.Get("response.datesRange.startDate"); value.Exists() { + if value := res.Get("response.datesRange.startDate"); value.Exists() && value.Type != gjson.Null { data.StartDate = types.StringValue(value.String()) } else { data.StartDate = types.StringNull() } - if value := res.Get("response.datesRange.endDate"); value.Exists() { + if value := res.Get("response.datesRange.endDate"); value.Exists() && value.Type != gjson.Null { data.EndDate = types.StringValue(value.String()) } else { data.EndDate = types.StringNull() } - if value := res.Get("response.datesRangeException.startDate"); value.Exists() { + if value := res.Get("response.datesRangeException.startDate"); value.Exists() && value.Type != gjson.Null { data.ExceptionStartDate = types.StringValue(value.String()) } else { data.ExceptionStartDate = types.StringNull() } - if value := res.Get("response.datesRangeException.endDate"); value.Exists() { + if value := res.Get("response.datesRangeException.endDate"); value.Exists() && value.Type != gjson.Null { data.ExceptionEndDate = types.StringValue(value.String()) } else { data.ExceptionEndDate = types.StringNull() } - if value := res.Get("response.hoursRange.startTime"); value.Exists() { + if value := res.Get("response.hoursRange.startTime"); value.Exists() && value.Type != gjson.Null { data.StartTime = types.StringValue(value.String()) } else { data.StartTime = types.StringNull() } - if value := res.Get("response.hoursRange.endTime"); value.Exists() { + if value := res.Get("response.hoursRange.endTime"); value.Exists() && value.Type != gjson.Null { data.EndTime = types.StringValue(value.String()) } else { data.EndTime = types.StringNull() } - if value := res.Get("response.hoursRangeException.startTime"); value.Exists() { + if value := res.Get("response.hoursRangeException.startTime"); value.Exists() && value.Type != gjson.Null { data.ExceptionStartTime = types.StringValue(value.String()) } else { data.ExceptionStartTime = types.StringNull() } - if value := res.Get("response.hoursRangeException.endTime"); value.Exists() { + if value := res.Get("response.hoursRangeException.endTime"); value.Exists() && value.Type != gjson.Null { data.ExceptionEndTime = types.StringValue(value.String()) } else { data.ExceptionEndTime = types.StringNull() diff --git a/internal/provider/model_ise_network_device.go b/internal/provider/model_ise_network_device.go index 1792dcd..2e79b49 100644 --- a/internal/provider/model_ise_network_device.go +++ b/internal/provider/model_ise_network_device.go @@ -248,67 +248,67 @@ func (data NetworkDevice) toBody(ctx context.Context, state NetworkDevice) strin //template:begin fromBody func (data *NetworkDevice) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("NetworkDevice.name"); value.Exists() { + if value := res.Get("NetworkDevice.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("NetworkDevice.description"); value.Exists() { + if value := res.Get("NetworkDevice.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("NetworkDevice.authenticationSettings.enableKeyWrap"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.enableKeyWrap"); value.Exists() && value.Type != gjson.Null { data.AuthenticationEnableKeyWrap = types.BoolValue(value.Bool()) } else { data.AuthenticationEnableKeyWrap = types.BoolNull() } - if value := res.Get("NetworkDevice.authenticationSettings.keyEncryptionKey"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.keyEncryptionKey"); value.Exists() && value.Type != gjson.Null { data.AuthenticationEncryptionKey = types.StringValue(value.String()) } else { data.AuthenticationEncryptionKey = types.StringNull() } - if value := res.Get("NetworkDevice.authenticationSettings.keyInputFormat"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.keyInputFormat"); value.Exists() && value.Type != gjson.Null { data.AuthenticationEncryptionKeyFormat = types.StringValue(value.String()) } else { data.AuthenticationEncryptionKeyFormat = types.StringNull() } - if value := res.Get("NetworkDevice.authenticationSettings.messageAuthenticatorCodeKey"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.messageAuthenticatorCodeKey"); value.Exists() && value.Type != gjson.Null { data.AuthenticationMessageAuthenticatorCodeKey = types.StringValue(value.String()) } else { data.AuthenticationMessageAuthenticatorCodeKey = types.StringNull() } - if value := res.Get("NetworkDevice.authenticationSettings.networkProtocol"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.networkProtocol"); value.Exists() && value.Type != gjson.Null { data.AuthenticationNetworkProtocol = types.StringValue(value.String()) } else { data.AuthenticationNetworkProtocol = types.StringNull() } - if value := res.Get("NetworkDevice.authenticationSettings.radiusSharedSecret"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.radiusSharedSecret"); value.Exists() && value.Type != gjson.Null { data.AuthenticationRadiusSharedSecret = types.StringValue(value.String()) } else { data.AuthenticationRadiusSharedSecret = types.StringNull() } - if value := res.Get("NetworkDevice.authenticationSettings.enableMultiSecret"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.enableMultiSecret"); value.Exists() && value.Type != gjson.Null { data.AuthenticationEnableMultiSecret = types.BoolValue(value.Bool()) } else { data.AuthenticationEnableMultiSecret = types.BoolNull() } - if value := res.Get("NetworkDevice.authenticationSettings.secondRadiusSharedSecret"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.secondRadiusSharedSecret"); value.Exists() && value.Type != gjson.Null { data.AuthenticationSecondRadiusSharedSecret = types.StringValue(value.String()) } else { data.AuthenticationSecondRadiusSharedSecret = types.StringNull() } - if value := res.Get("NetworkDevice.authenticationSettings.dtlsRequired"); value.Exists() { + if value := res.Get("NetworkDevice.authenticationSettings.dtlsRequired"); value.Exists() && value.Type != gjson.Null { data.AuthenticationDtlsRequired = types.BoolValue(value.Bool()) } else { data.AuthenticationDtlsRequired = types.BoolNull() } - if value := res.Get("NetworkDevice.coaPort"); value.Exists() { + if value := res.Get("NetworkDevice.coaPort"); value.Exists() && value.Type != gjson.Null { data.CoaPort = types.Int64Value(value.Int()) } else { data.CoaPort = types.Int64Value(1700) } - if value := res.Get("NetworkDevice.dtlsDnsName"); value.Exists() { + if value := res.Get("NetworkDevice.dtlsDnsName"); value.Exists() && value.Type != gjson.Null { data.DtlsDnsName = types.StringValue(value.String()) } else { data.DtlsDnsName = types.StringNull() @@ -317,17 +317,17 @@ func (data *NetworkDevice) fromBody(ctx context.Context, res gjson.Result) { data.Ips = make([]NetworkDeviceIps, 0) value.ForEach(func(k, v gjson.Result) bool { item := NetworkDeviceIps{} - if cValue := v.Get("ipaddress"); cValue.Exists() { + if cValue := v.Get("ipaddress"); cValue.Exists() && cValue.Type != gjson.Null { item.Ipaddress = types.StringValue(cValue.String()) } else { item.Ipaddress = types.StringNull() } - if cValue := v.Get("ipaddressExclude"); cValue.Exists() { + if cValue := v.Get("ipaddressExclude"); cValue.Exists() && cValue.Type != gjson.Null { item.IpaddressExclude = types.StringValue(cValue.String()) } else { item.IpaddressExclude = types.StringNull() } - if cValue := v.Get("mask"); cValue.Exists() { + if cValue := v.Get("mask"); cValue.Exists() && cValue.Type != gjson.Null { item.Mask = types.StringValue(cValue.String()) } else { item.Mask = types.StringNull() @@ -341,132 +341,132 @@ func (data *NetworkDevice) fromBody(ctx context.Context, res gjson.Result) { } else { data.NetworkDeviceGroups = types.SetNull(types.StringType) } - if value := res.Get("NetworkDevice.modelName"); value.Exists() { + if value := res.Get("NetworkDevice.modelName"); value.Exists() && value.Type != gjson.Null { data.ModelName = types.StringValue(value.String()) } else { data.ModelName = types.StringNull() } - if value := res.Get("NetworkDevice.softwareVersion"); value.Exists() { + if value := res.Get("NetworkDevice.softwareVersion"); value.Exists() && value.Type != gjson.Null { data.SoftwareVersion = types.StringValue(value.String()) } else { data.SoftwareVersion = types.StringNull() } - if value := res.Get("NetworkDevice.profileName"); value.Exists() { + if value := res.Get("NetworkDevice.profileName"); value.Exists() && value.Type != gjson.Null { data.ProfileName = types.StringValue(value.String()) } else { data.ProfileName = types.StringValue("Cisco") } - if value := res.Get("NetworkDevice.snmpsettings.linkTrapQuery"); value.Exists() { + if value := res.Get("NetworkDevice.snmpsettings.linkTrapQuery"); value.Exists() && value.Type != gjson.Null { data.SnmpLinkTrapQuery = types.BoolValue(value.Bool()) } else { data.SnmpLinkTrapQuery = types.BoolNull() } - if value := res.Get("NetworkDevice.snmpsettings.macTrapQuery"); value.Exists() { + if value := res.Get("NetworkDevice.snmpsettings.macTrapQuery"); value.Exists() && value.Type != gjson.Null { data.SnmpMacTrapQuery = types.BoolValue(value.Bool()) } else { data.SnmpMacTrapQuery = types.BoolNull() } - if value := res.Get("NetworkDevice.snmpsettings.originatingPolicyServicesNode"); value.Exists() { + if value := res.Get("NetworkDevice.snmpsettings.originatingPolicyServicesNode"); value.Exists() && value.Type != gjson.Null { data.SnmpOriginatingPolicyServiceNode = types.StringValue(value.String()) } else { data.SnmpOriginatingPolicyServiceNode = types.StringNull() } - if value := res.Get("NetworkDevice.snmpsettings.pollingInterval"); value.Exists() { + if value := res.Get("NetworkDevice.snmpsettings.pollingInterval"); value.Exists() && value.Type != gjson.Null { data.SnmpPollingInterval = types.Int64Value(value.Int()) } else { data.SnmpPollingInterval = types.Int64Null() } - if value := res.Get("NetworkDevice.snmpsettings.roCommunity"); value.Exists() { + if value := res.Get("NetworkDevice.snmpsettings.roCommunity"); value.Exists() && value.Type != gjson.Null { data.SnmpRoCommunity = types.StringValue(value.String()) } else { data.SnmpRoCommunity = types.StringNull() } - if value := res.Get("NetworkDevice.snmpsettings.version"); value.Exists() { + if value := res.Get("NetworkDevice.snmpsettings.version"); value.Exists() && value.Type != gjson.Null { data.SnmpVersion = types.StringValue(value.String()) } else { data.SnmpVersion = types.StringNull() } - if value := res.Get("NetworkDevice.tacacsSettings.connectModeOptions"); value.Exists() { + if value := res.Get("NetworkDevice.tacacsSettings.connectModeOptions"); value.Exists() && value.Type != gjson.Null { data.TacacsConnectModeOptions = types.StringValue(value.String()) } else { data.TacacsConnectModeOptions = types.StringNull() } - if value := res.Get("NetworkDevice.tacacsSettings.sharedSecret"); value.Exists() { + if value := res.Get("NetworkDevice.tacacsSettings.sharedSecret"); value.Exists() && value.Type != gjson.Null { data.TacacsSharedSecret = types.StringValue(value.String()) } else { data.TacacsSharedSecret = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.deviceAuthenticationSettings.sgaDeviceId"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.deviceAuthenticationSettings.sgaDeviceId"); value.Exists() && value.Type != gjson.Null { data.TrustsecDeviceId = types.StringValue(value.String()) } else { data.TrustsecDeviceId = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.deviceAuthenticationSettings.sgaDevicePassword"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.deviceAuthenticationSettings.sgaDevicePassword"); value.Exists() && value.Type != gjson.Null { data.TrustsecDevicePassword = types.StringValue(value.String()) } else { data.TrustsecDevicePassword = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.deviceAuthenticationSettings.restApiUsername"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.deviceAuthenticationSettings.restApiUsername"); value.Exists() && value.Type != gjson.Null { data.TrustsecRestApiUsername = types.StringValue(value.String()) } else { data.TrustsecRestApiUsername = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.enableModePassword"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.enableModePassword"); value.Exists() && value.Type != gjson.Null { data.TrustsecEnableModePassword = types.StringValue(value.String()) } else { data.TrustsecEnableModePassword = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.execModePassword"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.execModePassword"); value.Exists() && value.Type != gjson.Null { data.TrustsecExecModePassword = types.StringValue(value.String()) } else { data.TrustsecExecModePassword = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.execModeUsername"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.execModeUsername"); value.Exists() && value.Type != gjson.Null { data.TrustsecExecModeUsername = types.StringValue(value.String()) } else { data.TrustsecExecModeUsername = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.includeWhenDeployingSGTUpdates"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.deviceConfigurationDeployment.includeWhenDeployingSGTUpdates"); value.Exists() && value.Type != gjson.Null { data.TrustsecIncludeWhenDeployingSgtUpdates = types.BoolValue(value.Bool()) } else { data.TrustsecIncludeWhenDeployingSgtUpdates = types.BoolNull() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.downlaodEnvironmentDataEveryXSeconds"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.downlaodEnvironmentDataEveryXSeconds"); value.Exists() && value.Type != gjson.Null { data.TrustsecDownloadEnviromentDataEveryXSeconds = types.Int64Value(value.Int()) } else { data.TrustsecDownloadEnviromentDataEveryXSeconds = types.Int64Null() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.downlaodPeerAuthorizationPolicyEveryXSeconds"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.downlaodPeerAuthorizationPolicyEveryXSeconds"); value.Exists() && value.Type != gjson.Null { data.TrustsecDownloadPeerAuthorizationPolicyEveryXSeconds = types.Int64Value(value.Int()) } else { data.TrustsecDownloadPeerAuthorizationPolicyEveryXSeconds = types.Int64Null() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.downloadSGACLListsEveryXSeconds"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.downloadSGACLListsEveryXSeconds"); value.Exists() && value.Type != gjson.Null { data.TrustsecDownloadSgaclListsEveryXSeconds = types.Int64Value(value.Int()) } else { data.TrustsecDownloadSgaclListsEveryXSeconds = types.Int64Null() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.otherSGADevicesToTrustThisDevice"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.otherSGADevicesToTrustThisDevice"); value.Exists() && value.Type != gjson.Null { data.TrustsecOtherSgaDevicesToTrustThisDevice = types.BoolValue(value.Bool()) } else { data.TrustsecOtherSgaDevicesToTrustThisDevice = types.BoolNull() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.reAuthenticationEveryXSeconds"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.reAuthenticationEveryXSeconds"); value.Exists() && value.Type != gjson.Null { data.TrustsecReAuthenticationEveryXSeconds = types.Int64Value(value.Int()) } else { data.TrustsecReAuthenticationEveryXSeconds = types.Int64Null() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.sendConfigurationToDevice"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.sendConfigurationToDevice"); value.Exists() && value.Type != gjson.Null { data.TrustsecSendConfigurationToDevice = types.BoolValue(value.Bool()) } else { data.TrustsecSendConfigurationToDevice = types.BoolNull() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.sendConfigurationToDeviceUsing"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.sendConfigurationToDeviceUsing"); value.Exists() && value.Type != gjson.Null { data.TrustsecSendConfigurationToDeviceUsing = types.StringValue(value.String()) } else { data.TrustsecSendConfigurationToDeviceUsing = types.StringNull() } - if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.coaSourceHost"); value.Exists() { + if value := res.Get("NetworkDevice.trustsecsettings.sgaNotificationAndUpdates.coaSourceHost"); value.Exists() && value.Type != gjson.Null { data.TrustsecCoaSourceHost = types.StringValue(value.String()) } else { data.TrustsecCoaSourceHost = types.StringNull() diff --git a/internal/provider/model_ise_network_device_group.go b/internal/provider/model_ise_network_device_group.go index 54ff97a..6bf3607 100644 --- a/internal/provider/model_ise_network_device_group.go +++ b/internal/provider/model_ise_network_device_group.go @@ -70,17 +70,17 @@ func (data NetworkDeviceGroup) toBody(ctx context.Context, state NetworkDeviceGr //template:begin fromBody func (data *NetworkDeviceGroup) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("NetworkDeviceGroup.name"); value.Exists() { + if value := res.Get("NetworkDeviceGroup.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("NetworkDeviceGroup.description"); value.Exists() { + if value := res.Get("NetworkDeviceGroup.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("NetworkDeviceGroup.othername"); value.Exists() { + if value := res.Get("NetworkDeviceGroup.othername"); value.Exists() && value.Type != gjson.Null { data.RootGroup = types.StringValue(value.String()) } else { data.RootGroup = types.StringNull() diff --git a/internal/provider/model_ise_repository.go b/internal/provider/model_ise_repository.go index 0b74670..4ea9b38 100644 --- a/internal/provider/model_ise_repository.go +++ b/internal/provider/model_ise_repository.go @@ -86,27 +86,27 @@ func (data Repository) toBody(ctx context.Context, state Repository) string { //template:begin fromBody func (data *Repository) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("response.name"); value.Exists() { + if value := res.Get("response.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("response.protocol"); value.Exists() { + if value := res.Get("response.protocol"); value.Exists() && value.Type != gjson.Null { data.Protocol = types.StringValue(value.String()) } else { data.Protocol = types.StringNull() } - if value := res.Get("response.path"); value.Exists() { + if value := res.Get("response.path"); value.Exists() && value.Type != gjson.Null { data.Path = types.StringValue(value.String()) } else { data.Path = types.StringNull() } - if value := res.Get("response.serverName"); value.Exists() { + if value := res.Get("response.serverName"); value.Exists() && value.Type != gjson.Null { data.ServerName = types.StringValue(value.String()) } else { data.ServerName = types.StringNull() } - if value := res.Get("response.userName"); value.Exists() { + if value := res.Get("response.userName"); value.Exists() && value.Type != gjson.Null { data.UserName = types.StringValue(value.String()) } else { data.UserName = types.StringNull() diff --git a/internal/provider/model_ise_tacacs_command_set.go b/internal/provider/model_ise_tacacs_command_set.go index 0d7d552..2956b2a 100644 --- a/internal/provider/model_ise_tacacs_command_set.go +++ b/internal/provider/model_ise_tacacs_command_set.go @@ -93,17 +93,17 @@ func (data TACACSCommandSet) toBody(ctx context.Context, state TACACSCommandSet) //template:begin fromBody func (data *TACACSCommandSet) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("TacacsCommandSets.name"); value.Exists() { + if value := res.Get("TacacsCommandSets.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("TacacsCommandSets.description"); value.Exists() { + if value := res.Get("TacacsCommandSets.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("TacacsCommandSets.permitUnmatched"); value.Exists() { + if value := res.Get("TacacsCommandSets.permitUnmatched"); value.Exists() && value.Type != gjson.Null { data.PermitUnmatched = types.BoolValue(value.Bool()) } else { data.PermitUnmatched = types.BoolValue(false) @@ -112,17 +112,17 @@ func (data *TACACSCommandSet) fromBody(ctx context.Context, res gjson.Result) { data.Commands = make([]TACACSCommandSetCommands, 0) value.ForEach(func(k, v gjson.Result) bool { item := TACACSCommandSetCommands{} - if cValue := v.Get("grant"); cValue.Exists() { + if cValue := v.Get("grant"); cValue.Exists() && cValue.Type != gjson.Null { item.Grant = types.StringValue(cValue.String()) } else { item.Grant = types.StringNull() } - if cValue := v.Get("command"); cValue.Exists() { + if cValue := v.Get("command"); cValue.Exists() && cValue.Type != gjson.Null { item.Command = types.StringValue(cValue.String()) } else { item.Command = types.StringNull() } - if cValue := v.Get("arguments"); cValue.Exists() { + if cValue := v.Get("arguments"); cValue.Exists() && cValue.Type != gjson.Null { item.Arguments = types.StringValue(cValue.String()) } else { item.Arguments = types.StringNull() diff --git a/internal/provider/model_ise_tacacs_profile.go b/internal/provider/model_ise_tacacs_profile.go index 679fb4d..29a1c5f 100644 --- a/internal/provider/model_ise_tacacs_profile.go +++ b/internal/provider/model_ise_tacacs_profile.go @@ -89,12 +89,12 @@ func (data TACACSProfile) toBody(ctx context.Context, state TACACSProfile) strin //template:begin fromBody func (data *TACACSProfile) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("TacacsProfile.name"); value.Exists() { + if value := res.Get("TacacsProfile.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("TacacsProfile.description"); value.Exists() { + if value := res.Get("TacacsProfile.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() @@ -103,17 +103,17 @@ func (data *TACACSProfile) fromBody(ctx context.Context, res gjson.Result) { data.SessionAttributes = make([]TACACSProfileSessionAttributes, 0) value.ForEach(func(k, v gjson.Result) bool { item := TACACSProfileSessionAttributes{} - if cValue := v.Get("type"); cValue.Exists() { + if cValue := v.Get("type"); cValue.Exists() && cValue.Type != gjson.Null { item.Type = types.StringValue(cValue.String()) } else { item.Type = types.StringNull() } - if cValue := v.Get("name"); cValue.Exists() { + if cValue := v.Get("name"); cValue.Exists() && cValue.Type != gjson.Null { item.Name = types.StringValue(cValue.String()) } else { item.Name = types.StringNull() } - if cValue := v.Get("value"); cValue.Exists() { + if cValue := v.Get("value"); cValue.Exists() && cValue.Type != gjson.Null { item.Value = types.StringValue(cValue.String()) } else { item.Value = types.StringNull() diff --git a/internal/provider/model_ise_trustsec_egress_matrix_cell.go b/internal/provider/model_ise_trustsec_egress_matrix_cell.go index 7844f3e..90a124e 100644 --- a/internal/provider/model_ise_trustsec_egress_matrix_cell.go +++ b/internal/provider/model_ise_trustsec_egress_matrix_cell.go @@ -88,17 +88,17 @@ func (data TrustSecEgressMatrixCell) toBody(ctx context.Context, state TrustSecE //template:begin fromBody func (data *TrustSecEgressMatrixCell) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("EgressMatrixCell.description"); value.Exists() { + if value := res.Get("EgressMatrixCell.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("EgressMatrixCell.defaultRule"); value.Exists() { + if value := res.Get("EgressMatrixCell.defaultRule"); value.Exists() && value.Type != gjson.Null { data.DefaultRule = types.StringValue(value.String()) } else { data.DefaultRule = types.StringValue("NONE") } - if value := res.Get("EgressMatrixCell.matrixCellStatus"); value.Exists() { + if value := res.Get("EgressMatrixCell.matrixCellStatus"); value.Exists() && value.Type != gjson.Null { data.MatrixCellStatus = types.StringValue(value.String()) } else { data.MatrixCellStatus = types.StringValue("DISABLED") @@ -108,12 +108,12 @@ func (data *TrustSecEgressMatrixCell) fromBody(ctx context.Context, res gjson.Re } else { data.Sgacls = types.SetNull(types.StringType) } - if value := res.Get("EgressMatrixCell.sourceSgtId"); value.Exists() { + if value := res.Get("EgressMatrixCell.sourceSgtId"); value.Exists() && value.Type != gjson.Null { data.SourceSgtId = types.StringValue(value.String()) } else { data.SourceSgtId = types.StringNull() } - if value := res.Get("EgressMatrixCell.destinationSgtId"); value.Exists() { + if value := res.Get("EgressMatrixCell.destinationSgtId"); value.Exists() && value.Type != gjson.Null { data.DestinationSgtId = types.StringValue(value.String()) } else { data.DestinationSgtId = types.StringNull() diff --git a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go index 176a268..89eadcb 100644 --- a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go +++ b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go @@ -90,42 +90,42 @@ func (data TrustSecIPToSGTMapping) toBody(ctx context.Context, state TrustSecIPT //template:begin fromBody func (data *TrustSecIPToSGTMapping) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("SGMapping.name"); value.Exists() { + if value := res.Get("SGMapping.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("SGMapping.description"); value.Exists() { + if value := res.Get("SGMapping.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("SGMapping.deployTo"); value.Exists() { + if value := res.Get("SGMapping.deployTo"); value.Exists() && value.Type != gjson.Null { data.DeployTo = types.StringValue(value.String()) } else { data.DeployTo = types.StringNull() } - if value := res.Get("SGMapping.deployType"); value.Exists() { + if value := res.Get("SGMapping.deployType"); value.Exists() && value.Type != gjson.Null { data.DeployType = types.StringValue(value.String()) } else { data.DeployType = types.StringNull() } - if value := res.Get("SGMapping.hostName"); value.Exists() { + if value := res.Get("SGMapping.hostName"); value.Exists() && value.Type != gjson.Null { data.HostName = types.StringValue(value.String()) } else { data.HostName = types.StringNull() } - if value := res.Get("SGMapping.hostIp"); value.Exists() { + if value := res.Get("SGMapping.hostIp"); value.Exists() && value.Type != gjson.Null { data.HostIp = types.StringValue(value.String()) } else { data.HostIp = types.StringNull() } - if value := res.Get("SGMapping.sgt"); value.Exists() { + if value := res.Get("SGMapping.sgt"); value.Exists() && value.Type != gjson.Null { data.Sgt = types.StringValue(value.String()) } else { data.Sgt = types.StringNull() } - if value := res.Get("SGMapping.mappingGroup"); value.Exists() { + if value := res.Get("SGMapping.mappingGroup"); value.Exists() && value.Type != gjson.Null { data.MappingGroup = types.StringValue(value.String()) } else { data.MappingGroup = types.StringNull() diff --git a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go index 954dc67..09a2e10 100644 --- a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go +++ b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go @@ -78,27 +78,27 @@ func (data TrustSecIPToSGTMappingGroup) toBody(ctx context.Context, state TrustS //template:begin fromBody func (data *TrustSecIPToSGTMappingGroup) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("SGMappingGroup.name"); value.Exists() { + if value := res.Get("SGMappingGroup.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("SGMappingGroup.description"); value.Exists() { + if value := res.Get("SGMappingGroup.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("SGMappingGroup.deployTo"); value.Exists() { + if value := res.Get("SGMappingGroup.deployTo"); value.Exists() && value.Type != gjson.Null { data.DeployTo = types.StringValue(value.String()) } else { data.DeployTo = types.StringNull() } - if value := res.Get("SGMappingGroup.deployType"); value.Exists() { + if value := res.Get("SGMappingGroup.deployType"); value.Exists() && value.Type != gjson.Null { data.DeployType = types.StringValue(value.String()) } else { data.DeployType = types.StringNull() } - if value := res.Get("SGMappingGroup.sgt"); value.Exists() { + if value := res.Get("SGMappingGroup.sgt"); value.Exists() && value.Type != gjson.Null { data.Sgt = types.StringValue(value.String()) } else { data.Sgt = types.StringNull() diff --git a/internal/provider/model_ise_trustsec_security_group.go b/internal/provider/model_ise_trustsec_security_group.go index 7b79ed8..5013b14 100644 --- a/internal/provider/model_ise_trustsec_security_group.go +++ b/internal/provider/model_ise_trustsec_security_group.go @@ -78,22 +78,22 @@ func (data TrustSecSecurityGroup) toBody(ctx context.Context, state TrustSecSecu //template:begin fromBody func (data *TrustSecSecurityGroup) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("Sgt.name"); value.Exists() { + if value := res.Get("Sgt.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("Sgt.description"); value.Exists() { + if value := res.Get("Sgt.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("Sgt.value"); value.Exists() { + if value := res.Get("Sgt.value"); value.Exists() && value.Type != gjson.Null { data.Value = types.Int64Value(value.Int()) } else { data.Value = types.Int64Null() } - if value := res.Get("Sgt.propogateToApic"); value.Exists() { + if value := res.Get("Sgt.propogateToApic"); value.Exists() && value.Type != gjson.Null { data.PropogateToApic = types.BoolValue(value.Bool()) } else { data.PropogateToApic = types.BoolNull() diff --git a/internal/provider/model_ise_trustsec_security_group_acl.go b/internal/provider/model_ise_trustsec_security_group_acl.go index a59de86..760b9c6 100644 --- a/internal/provider/model_ise_trustsec_security_group_acl.go +++ b/internal/provider/model_ise_trustsec_security_group_acl.go @@ -78,22 +78,22 @@ func (data TrustSecSecurityGroupACL) toBody(ctx context.Context, state TrustSecS //template:begin fromBody func (data *TrustSecSecurityGroupACL) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("Sgacl.name"); value.Exists() { + if value := res.Get("Sgacl.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("Sgacl.description"); value.Exists() { + if value := res.Get("Sgacl.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("Sgacl.aclcontent"); value.Exists() { + if value := res.Get("Sgacl.aclcontent"); value.Exists() && value.Type != gjson.Null { data.AclContent = types.StringValue(value.String()) } else { data.AclContent = types.StringNull() } - if value := res.Get("Sgacl.ipVersion"); value.Exists() { + if value := res.Get("Sgacl.ipVersion"); value.Exists() && value.Type != gjson.Null { data.IpVersion = types.StringValue(value.String()) } else { data.IpVersion = types.StringValue("IP_AGNOSTIC") diff --git a/internal/provider/model_ise_user_identity_group.go b/internal/provider/model_ise_user_identity_group.go index aab38e7..c51e92c 100644 --- a/internal/provider/model_ise_user_identity_group.go +++ b/internal/provider/model_ise_user_identity_group.go @@ -70,17 +70,17 @@ func (data UserIdentityGroup) toBody(ctx context.Context, state UserIdentityGrou //template:begin fromBody func (data *UserIdentityGroup) fromBody(ctx context.Context, res gjson.Result) { - if value := res.Get("IdentityGroup.name"); value.Exists() { + if value := res.Get("IdentityGroup.name"); value.Exists() && value.Type != gjson.Null { data.Name = types.StringValue(value.String()) } else { data.Name = types.StringNull() } - if value := res.Get("IdentityGroup.description"); value.Exists() { + if value := res.Get("IdentityGroup.description"); value.Exists() && value.Type != gjson.Null { data.Description = types.StringValue(value.String()) } else { data.Description = types.StringNull() } - if value := res.Get("IdentityGroup.parent"); value.Exists() { + if value := res.Get("IdentityGroup.parent"); value.Exists() && value.Type != gjson.Null { data.Parent = types.StringValue(value.String()) } else { data.Parent = types.StringNull() diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 63b4ae9..28dafbe 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -263,6 +263,7 @@ func (p *IseProvider) Resources(ctx context.Context) []func() resource.Resource NewInternalUserResource, NewLicenseTierStateResource, NewNetworkAccessAuthenticationRuleResource, + NewNetworkAccessAuthenticationRuleUpdateRankResource, NewNetworkAccessAuthorizationExceptionRuleResource, NewNetworkAccessAuthorizationGlobalExceptionRuleResource, NewNetworkAccessAuthorizationRuleResource, diff --git a/internal/provider/resource_ise_network_access_authentication_rule.go b/internal/provider/resource_ise_network_access_authentication_rule.go index 4d0e94f..535d4d7 100644 --- a/internal/provider/resource_ise_network_access_authentication_rule.go +++ b/internal/provider/resource_ise_network_access_authentication_rule.go @@ -38,6 +38,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-ise" "github.com/tidwall/gjson" + "github.com/tidwall/sjson" ) //template:end imports @@ -288,6 +289,7 @@ func (r *NetworkAccessAuthenticationRuleResource) Create(ctx context.Context, re // Create object body := plan.toBody(ctx, NetworkAccessAuthenticationRule{}) + if plan.Name.ValueString() != "Default" { res, _, err := r.client.Post(plan.getPath(), body) if err != nil { @@ -359,9 +361,8 @@ func (r *NetworkAccessAuthenticationRuleResource) Read(ctx context.Context, req //template:end read -//template:begin update func (r *NetworkAccessAuthenticationRuleResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var plan, state NetworkAccessAuthenticationRule + var plan, state, existingData NetworkAccessAuthenticationRule // Read plan diags := req.Plan.Get(ctx, &plan) @@ -379,6 +380,20 @@ func (r *NetworkAccessAuthenticationRuleResource) Update(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Id.ValueString())) body := plan.toBody(ctx, state) + // Check if plan.Rank is null (i.e., not provided) and set rank to body from existingData to not reorder rule during update + if plan.Rank.IsNull() { + // Read existing attributes from the API + res, err := r.client.Get(plan.getPath() + "/" + url.QueryEscape(plan.Id.ValueString())) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s", err)) + return + } + existingData.fromBody(ctx, res) + + // If plan.Rank is not provided, set it from existingData.Rank + body, _ = sjson.Set(body, "rule.rank", existingData.Rank.ValueInt64()) + } + res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) @@ -391,8 +406,6 @@ func (r *NetworkAccessAuthenticationRuleResource) Update(ctx context.Context, re resp.Diagnostics.Append(diags...) } -//template:end update - //template:begin delete func (r *NetworkAccessAuthenticationRuleResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state NetworkAccessAuthenticationRule diff --git a/internal/provider/resource_ise_network_access_authentication_rule_update_rank.go b/internal/provider/resource_ise_network_access_authentication_rule_update_rank.go new file mode 100644 index 0000000..f1ee9d7 --- /dev/null +++ b/internal/provider/resource_ise_network_access_authentication_rule_update_rank.go @@ -0,0 +1,252 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +//template:begin imports +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/CiscoDevNet/terraform-provider-ise/internal/provider/helpers" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/netascode/go-ise" + "github.com/tidwall/sjson" +) + +//template:end imports + +//template:begin header + +// Ensure provider defined types fully satisfy framework interfaces +var _ resource.Resource = &NetworkAccessAuthenticationRuleUpdateRankResource{} + +func NewNetworkAccessAuthenticationRuleUpdateRankResource() resource.Resource { + return &NetworkAccessAuthenticationRuleUpdateRankResource{} +} + +type NetworkAccessAuthenticationRuleUpdateRankResource struct { + client *ise.Client +} + +func (r *NetworkAccessAuthenticationRuleUpdateRankResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_network_access_authentication_rule_update_rank" +} + +//template:end header + +//template:begin model +func (r *NetworkAccessAuthenticationRuleUpdateRankResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: helpers.NewAttributeDescription("This resource is used to update rank field in network access authentication rule. It serves as a workaround for the ISE API/Backend limitation which restricts rank assignments to a strictly incremental sequence. By utilizing this resource and network_access_authentication_rule resource, you can bypass the APIs limitation. Creation of this resource is performing PUT operation (Update) and it only tracks rank field. When this resource is destroyed, no action is performed on ISE and resource is just removed from state.").String, + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + MarkdownDescription: "The id of the object", + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "auth_rule_id": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Authentication rule ID").String, + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "policy_set_id": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Policy set ID").String, + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "rank": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("The rank (priority) in relation to other rules. Lower rank is higher priority.").String, + Required: true, + }, + }, + } +} + +//template:end model + +//template:begin configure +func (r *NetworkAccessAuthenticationRuleUpdateRankResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + r.client = req.ProviderData.(*IseProviderData).Client +} + +//template:end configure + +func (r *NetworkAccessAuthenticationRuleUpdateRankResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var plan NetworkAccessAuthenticationRuleUpdateRank + var existingData NetworkAccessAuthenticationRule + + // Read plan + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + + // Read existing attributes from the API + res, err := r.client.Get(plan.getPath() + "/" + url.QueryEscape(plan.AuthRuleId.ValueString())) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s", err)) + return + } + existingData.fromBody(ctx, res) + + // Use the `toBody` function to construct the body from existingData + body := existingData.toBody(ctx, existingData) + + // Update rank + body, _ = sjson.Set(body, "rule.rank", plan.Rank.ValueInt64()) + + res, err = r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.AuthRuleId.ValueString()), body) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } + plan.Id = types.StringValue(fmt.Sprint(plan.AuthRuleId.ValueString())) + + tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Id.ValueString())) + + diags = resp.State.Set(ctx, &plan) + resp.Diagnostics.Append(diags...) +} + +//template:begin read +func (r *NetworkAccessAuthenticationRuleUpdateRankResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var state NetworkAccessAuthenticationRuleUpdateRank + + // Read state + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Id.String())) + res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString())) + if err != nil && strings.Contains(err.Error(), "StatusCode 404") { + resp.State.RemoveResource(ctx) + return + } else if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String())) + return + } + + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) + + diags = resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) +} + +//template:end read + +func (r *NetworkAccessAuthenticationRuleUpdateRankResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var plan, state NetworkAccessAuthenticationRuleUpdateRank + var existingData NetworkAccessAuthenticationRule + + // Read plan + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + // Read state + diags = req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Id.ValueString())) + + // Read existing attributes from the API + res, err := r.client.Get(plan.getPath() + "/" + url.QueryEscape(plan.AuthRuleId.ValueString())) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s", err)) + return + } + existingData.fromBody(ctx, res) + + // Use the `toBody` function to construct the body from existingData + body := existingData.toBody(ctx, existingData) + + // Update rank + body, _ = sjson.Set(body, "rule.rank", plan.Rank.ValueInt64()) + + res, err = r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Id.ValueString())) + + diags = resp.State.Set(ctx, &plan) + resp.Diagnostics.Append(diags...) +} + +//template:begin delete +func (r *NetworkAccessAuthenticationRuleUpdateRankResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + var state NetworkAccessAuthenticationRuleUpdateRank + + // Read state + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + + tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) + + resp.State.RemoveResource(ctx) +} + +//template:end delete + +//template:begin import +//template:end import diff --git a/internal/provider/resource_ise_network_access_authentication_rule_update_rank_test.go b/internal/provider/resource_ise_network_access_authentication_rule_update_rank_test.go new file mode 100644 index 0000000..47bb2ae --- /dev/null +++ b/internal/provider/resource_ise_network_access_authentication_rule_update_rank_test.go @@ -0,0 +1,105 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +//template:begin imports +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +//template:end imports + +//template:begin testAcc +func TestAccIseNetworkAccessAuthenticationRuleUpdateRank(t *testing.T) { + var checks []resource.TestCheckFunc + checks = append(checks, resource.TestCheckResourceAttr("ise_network_access_authentication_rule_update_rank.test", "rank", "0")) + + var steps []resource.TestStep + steps = append(steps, resource.TestStep{ + Config: testAccIseNetworkAccessAuthenticationRuleUpdateRankPrerequisitesConfig + testAccIseNetworkAccessAuthenticationRuleUpdateRankConfig_all(), + Check: resource.ComposeTestCheckFunc(checks...), + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: steps, + }) +} + +//template:end testAcc + +//template:begin testPrerequisites +const testAccIseNetworkAccessAuthenticationRuleUpdateRankPrerequisitesConfig = ` +resource "ise_network_access_policy_set" "test" { + name = "PolicySet1" + service_name = "Default Network Access" + condition_type = "ConditionAttributes" + condition_is_negate = false + condition_attribute_name = "Location" + condition_attribute_value = "All Locations" + condition_dictionary_name = "DEVICE" + condition_operator = "equals" +} +resource "ise_network_access_authentication_rule" "test" { + policy_set_id = ise_network_access_policy_set.test.id + name = "Rule1" + default = false + state = "enabled" + condition_type = "ConditionAttributes" + condition_is_negate = false + condition_attribute_name = "Location" + condition_attribute_value = "All Locations" + condition_dictionary_name = "DEVICE" + condition_operator = "equals" + identity_source_name = "Internal Endpoints" + if_auth_fail = "REJECT" + if_process_fail = "DROP" + if_user_not_found = "REJECT" +} +` + +//template:end testPrerequisites + +//template:begin testAccConfigMinimal +func testAccIseNetworkAccessAuthenticationRuleUpdateRankConfig_minimum() string { + config := `resource "ise_network_access_authentication_rule_update_rank" "test" {` + "\n" + config += ` auth_rule_id = ise_network_access_authentication_rule.test.id` + "\n" + config += ` policy_set_id = ise_network_access_policy_set.test.id` + "\n" + config += ` rank = 0` + "\n" + config += `}` + "\n" + return config +} + +//template:end testAccConfigMinimal + +//template:begin testAccConfigAll +func testAccIseNetworkAccessAuthenticationRuleUpdateRankConfig_all() string { + config := `resource "ise_network_access_authentication_rule_update_rank" "test" {` + "\n" + config += ` auth_rule_id = ise_network_access_authentication_rule.test.id` + "\n" + config += ` policy_set_id = ise_network_access_policy_set.test.id` + "\n" + config += ` rank = 0` + "\n" + config += `}` + "\n" + return config +} + +//template:end testAccConfigAll diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index e5174ad..048df6e 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.2.3 (unreleased) + +- Add resource `network_access_authentication_rule_update_rank` for updating rank under network access authentication rule to bypass API limitation which restricts rank assignments to a strictly incremental sequence + ## 0.2.2 - Fix issue with `ise_repository` triggers in-place upgrade when no changes are made #59