diff --git a/docs/data-sources/device_admin_authorization_rule.md b/docs/data-sources/device_admin_authorization_rule.md index 976f990..e898dd8 100644 --- a/docs/data-sources/device_admin_authorization_rule.md +++ b/docs/data-sources/device_admin_authorization_rule.md @@ -44,6 +44,7 @@ data "ise_device_admin_authorization_rule" "example" { - `condition_operator` (String) Equality operator - `condition_type` (String) Indicates whether the record is the condition itself or a logical aggregation. Logical aggreation indicates that additional conditions are present under the children attribute. - `default` (Boolean) Indicates if this rule is the default one +- `profile` (String) Device admin profiles control the initial login session of the device administrator - `rank` (Number) The rank (priority) in relation to other rules. Lower rank is higher priority. - `state` (String) The state that the rule is in. A disabled rule cannot be matched. diff --git a/docs/resources/device_admin_authorization_rule.md b/docs/resources/device_admin_authorization_rule.md index 3559d47..ba31205 100644 --- a/docs/resources/device_admin_authorization_rule.md +++ b/docs/resources/device_admin_authorization_rule.md @@ -26,6 +26,7 @@ resource "ise_device_admin_authorization_rule" "example" { condition_dictionary_name = "DEVICE" condition_operator = "equals" command_sets = ["DenyAllCommands"] + profile = "Default Shell Profile" } ``` @@ -52,6 +53,7 @@ resource "ise_device_admin_authorization_rule" "example" { - `condition_type` (String) Indicates whether the record is the condition itself or a logical aggregation. Logical aggreation indicates that additional conditions are present under the children attribute. - Choices: `ConditionAndBlock`, `ConditionAttributes`, `ConditionOrBlock`, `ConditionReference` - `default` (Boolean) Indicates if this rule is the default one +- `profile` (String) Device admin profiles control the initial login session of the device administrator - `rank` (Number) The rank (priority) in relation to other rules. Lower rank is higher priority. - `state` (String) The state that the rule is in. A disabled rule cannot be matched. - Choices: `disabled`, `enabled`, `monitor` diff --git a/examples/resources/ise_device_admin_authorization_rule/resource.tf b/examples/resources/ise_device_admin_authorization_rule/resource.tf index 3788c4b..1b2b642 100644 --- a/examples/resources/ise_device_admin_authorization_rule/resource.tf +++ b/examples/resources/ise_device_admin_authorization_rule/resource.tf @@ -11,4 +11,5 @@ resource "ise_device_admin_authorization_rule" "example" { condition_dictionary_name = "DEVICE" condition_operator = "equals" command_sets = ["DenyAllCommands"] + profile = "Default Shell Profile" } diff --git a/gen/definitions/device_admin_authorization_rule.yaml b/gen/definitions/device_admin_authorization_rule.yaml index c7c0ab2..4fb7881 100644 --- a/gen/definitions/device_admin_authorization_rule.yaml +++ b/gen/definitions/device_admin_authorization_rule.yaml @@ -253,6 +253,10 @@ attributes: description: Command sets enforce the specified list of commands that can be executed by a device administrator example: DenyAllCommands minimum_test_value: '["DenyAllCommands"]' + - model_name: profile + type: String + description: Device admin profiles control the initial login session of the device administrator + example: Default Shell Profile test_prerequisites: | resource "ise_device_admin_policy_set" "test" { diff --git a/internal/provider/data_source_ise_device_admin_authorization_rule.go b/internal/provider/data_source_ise_device_admin_authorization_rule.go index 9e40eff..23cf123 100644 --- a/internal/provider/data_source_ise_device_admin_authorization_rule.go +++ b/internal/provider/data_source_ise_device_admin_authorization_rule.go @@ -205,6 +205,10 @@ func (d *DeviceAdminAuthorizationRuleDataSource) Schema(ctx context.Context, req ElementType: types.StringType, Computed: true, }, + "profile": schema.StringAttribute{ + MarkdownDescription: "Device admin profiles control the initial login session of the device administrator", + Computed: true, + }, }, } } diff --git a/internal/provider/data_source_ise_device_admin_authorization_rule_test.go b/internal/provider/data_source_ise_device_admin_authorization_rule_test.go index e6b2f6a..bf1f0c9 100644 --- a/internal/provider/data_source_ise_device_admin_authorization_rule_test.go +++ b/internal/provider/data_source_ise_device_admin_authorization_rule_test.go @@ -42,6 +42,7 @@ func TestAccDataSourceIseDeviceAdminAuthorizationRule(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.ise_device_admin_authorization_rule.test", "condition_dictionary_name", "DEVICE")) checks = append(checks, resource.TestCheckResourceAttr("data.ise_device_admin_authorization_rule.test", "condition_operator", "equals")) checks = append(checks, resource.TestCheckResourceAttr("data.ise_device_admin_authorization_rule.test", "command_sets.0", "DenyAllCommands")) + checks = append(checks, resource.TestCheckResourceAttr("data.ise_device_admin_authorization_rule.test", "profile", "Default Shell Profile")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -96,6 +97,7 @@ func testAccDataSourceIseDeviceAdminAuthorizationRuleConfig() string { config += ` condition_dictionary_name = "DEVICE"` + "\n" config += ` condition_operator = "equals"` + "\n" config += ` command_sets = ["DenyAllCommands"]` + "\n" + config += ` profile = "Default Shell Profile"` + "\n" config += `}` + "\n" config += ` diff --git a/internal/provider/model_ise_device_admin_authorization_rule.go b/internal/provider/model_ise_device_admin_authorization_rule.go index fc2d7dc..332c4c2 100644 --- a/internal/provider/model_ise_device_admin_authorization_rule.go +++ b/internal/provider/model_ise_device_admin_authorization_rule.go @@ -51,6 +51,7 @@ type DeviceAdminAuthorizationRule struct { ConditionOperator types.String `tfsdk:"condition_operator"` Children []DeviceAdminAuthorizationRuleChildren `tfsdk:"children"` CommandSets types.List `tfsdk:"command_sets"` + Profile types.String `tfsdk:"profile"` } type DeviceAdminAuthorizationRuleChildren struct { @@ -191,6 +192,9 @@ func (data DeviceAdminAuthorizationRule) toBody(ctx context.Context, state Devic data.CommandSets.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "commands", values) } + if !data.Profile.IsNull() { + body, _ = sjson.Set(body, "profile", data.Profile.ValueString()) + } return body } @@ -359,6 +363,11 @@ func (data *DeviceAdminAuthorizationRule) fromBody(ctx context.Context, res gjso } else { data.CommandSets = types.ListNull(types.StringType) } + if value := res.Get("response.profile"); value.Exists() { + data.Profile = types.StringValue(value.String()) + } else { + data.Profile = types.StringNull() + } } //template:end fromBody @@ -558,6 +567,11 @@ func (data *DeviceAdminAuthorizationRule) updateFromBody(ctx context.Context, re } else { data.CommandSets = types.ListNull(types.StringType) } + if value := res.Get("response.profile"); value.Exists() && !data.Profile.IsNull() { + data.Profile = types.StringValue(value.String()) + } else { + data.Profile = types.StringNull() + } } //template:end updateFromBody diff --git a/internal/provider/resource_ise_device_admin_authorization_rule.go b/internal/provider/resource_ise_device_admin_authorization_rule.go index c68b519..0d72867 100644 --- a/internal/provider/resource_ise_device_admin_authorization_rule.go +++ b/internal/provider/resource_ise_device_admin_authorization_rule.go @@ -232,6 +232,10 @@ func (r *DeviceAdminAuthorizationRuleResource) Schema(ctx context.Context, req r ElementType: types.StringType, Optional: true, }, + "profile": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Device admin profiles control the initial login session of the device administrator").String, + Optional: true, + }, }, } } diff --git a/internal/provider/resource_ise_device_admin_authorization_rule_test.go b/internal/provider/resource_ise_device_admin_authorization_rule_test.go index ca17630..2b3ba74 100644 --- a/internal/provider/resource_ise_device_admin_authorization_rule_test.go +++ b/internal/provider/resource_ise_device_admin_authorization_rule_test.go @@ -43,6 +43,7 @@ func TestAccIseDeviceAdminAuthorizationRule(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("ise_device_admin_authorization_rule.test", "condition_dictionary_name", "DEVICE")) checks = append(checks, resource.TestCheckResourceAttr("ise_device_admin_authorization_rule.test", "condition_operator", "equals")) checks = append(checks, resource.TestCheckResourceAttr("ise_device_admin_authorization_rule.test", "command_sets.0", "DenyAllCommands")) + checks = append(checks, resource.TestCheckResourceAttr("ise_device_admin_authorization_rule.test", "profile", "Default Shell Profile")) var steps []resource.TestStep if os.Getenv("SKIP_MINIMUM_TEST") == "" { @@ -118,6 +119,7 @@ func testAccIseDeviceAdminAuthorizationRuleConfig_all() string { config += ` condition_dictionary_name = "DEVICE"` + "\n" config += ` condition_operator = "equals"` + "\n" config += ` command_sets = ["DenyAllCommands"]` + "\n" + config += ` profile = "Default Shell Profile"` + "\n" config += `}` + "\n" return config }