From e7924257bf2f3ba3bb768758156fd41795f0ec46 Mon Sep 17 00:00:00 2001 From: Shaun Colley Date: Thu, 2 Nov 2023 13:51:53 -0400 Subject: [PATCH 1/2] fix(IAM Policy Management): Updated rule conditions based on api def change Signed-off-by: Shaun Colley --- .../iam_policy_management_v1.go | 201 ++++++++++++++---- .../iam_policy_management_v1_examples_test.go | 20 +- ...m_policy_management_v1_integration_test.go | 18 +- .../iam_policy_management_v1_test.go | 27 ++- 4 files changed, 193 insertions(+), 73 deletions(-) diff --git a/iampolicymanagementv1/iam_policy_management_v1.go b/iampolicymanagementv1/iam_policy_management_v1.go index a04025a7..3cfa2dc3 100644 --- a/iampolicymanagementv1/iam_policy_management_v1.go +++ b/iampolicymanagementv1/iam_policy_management_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.65.0-79fc0b8f-20230209-215651 + * IBM OpenAPI SDK Code Generator Version: 3.81.0-c73a091c-20231026-215706 */ // Package iampolicymanagementv1 : Operations and models for the IamPolicyManagementV1 service @@ -5606,52 +5606,51 @@ func UnmarshalRuleAttribute(m map[string]json.RawMessage, result interface{}) (e return } -// RuleAttributeWithConditions : Rule that specifies additional conditions. -type RuleAttributeWithConditions struct { +// RuleWithNestedConditionsConditionsItem : RuleWithNestedConditionsConditionsItem struct +// Models which "extend" this model: +// - RuleWithNestedConditionsConditionsItemRuleAttribute +// - RuleWithNestedConditionsConditionsItemRuleWithConditions +type RuleWithNestedConditionsConditionsItem struct { // The name of an attribute. Key *string `json:"key,omitempty"` // The operator of an attribute. - Operator *string `json:"operator" validate:"required"` + Operator *string `json:"operator,omitempty"` // The value of a rule or resource attribute; can be boolean or string for resource attribute. Can be string or an // array of strings (e.g., array of days to permit access) for rule attribute. Value interface{} `json:"value,omitempty"` - // List of additional conditions associated with a policy, e.g., time-based conditions that grant access over a certain - // time period. + // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time + // period. Conditions []RuleAttribute `json:"conditions,omitempty"` } -// Constants associated with the RuleAttributeWithConditions.Operator property. +// Constants associated with the RuleWithNestedConditionsConditionsItem.Operator property. // The operator of an attribute. const ( - RuleAttributeWithConditionsOperatorAndConst = "and" - RuleAttributeWithConditionsOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" - RuleAttributeWithConditionsOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" - RuleAttributeWithConditionsOperatorDatetimelessthanConst = "dateTimeLessThan" - RuleAttributeWithConditionsOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" - RuleAttributeWithConditionsOperatorDayofweekanyofConst = "dayOfWeekAnyOf" - RuleAttributeWithConditionsOperatorDayofweekequalsConst = "dayOfWeekEquals" - RuleAttributeWithConditionsOperatorOrConst = "or" - RuleAttributeWithConditionsOperatorTimegreaterthanConst = "timeGreaterThan" - RuleAttributeWithConditionsOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" - RuleAttributeWithConditionsOperatorTimelessthanConst = "timeLessThan" - RuleAttributeWithConditionsOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" + RuleWithNestedConditionsConditionsItemOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" + RuleWithNestedConditionsConditionsItemOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" + RuleWithNestedConditionsConditionsItemOperatorDatetimelessthanConst = "dateTimeLessThan" + RuleWithNestedConditionsConditionsItemOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" + RuleWithNestedConditionsConditionsItemOperatorDayofweekanyofConst = "dayOfWeekAnyOf" + RuleWithNestedConditionsConditionsItemOperatorDayofweekequalsConst = "dayOfWeekEquals" + RuleWithNestedConditionsConditionsItemOperatorTimegreaterthanConst = "timeGreaterThan" + RuleWithNestedConditionsConditionsItemOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" + RuleWithNestedConditionsConditionsItemOperatorTimelessthanConst = "timeLessThan" + RuleWithNestedConditionsConditionsItemOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" ) +func (*RuleWithNestedConditionsConditionsItem) isaRuleWithNestedConditionsConditionsItem() bool { + return true +} -// NewRuleAttributeWithConditions : Instantiate RuleAttributeWithConditions (Generic Model Constructor) -func (*IamPolicyManagementV1) NewRuleAttributeWithConditions(operator string) (_model *RuleAttributeWithConditions, err error) { - _model = &RuleAttributeWithConditions{ - Operator: core.StringPtr(operator), - } - err = core.ValidateStruct(_model, "required parameters") - return +type RuleWithNestedConditionsConditionsItemIntf interface { + isaRuleWithNestedConditionsConditionsItem() bool } -// UnmarshalRuleAttributeWithConditions unmarshals an instance of RuleAttributeWithConditions from the specified map of raw messages. -func UnmarshalRuleAttributeWithConditions(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RuleAttributeWithConditions) +// UnmarshalRuleWithNestedConditionsConditionsItem unmarshals an instance of RuleWithNestedConditionsConditionsItem from the specified map of raw messages. +func UnmarshalRuleWithNestedConditionsConditionsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RuleWithNestedConditionsConditionsItem) err = core.UnmarshalPrimitive(m, "key", &obj.Key) if err != nil { return @@ -6192,7 +6191,7 @@ func UnmarshalV2PolicyResourceTag(m map[string]json.RawMessage, result interface // V2PolicyRule : Additional access conditions associated with the policy. // Models which "extend" this model: // - V2PolicyRuleRuleAttribute -// - V2PolicyRuleRuleWithConditions +// - V2PolicyRuleRuleWithNestedConditions type V2PolicyRule struct { // The name of an attribute. Key *string `json:"key,omitempty"` @@ -6206,7 +6205,7 @@ type V2PolicyRule struct { // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time // period. - Conditions []RuleAttributeWithConditions `json:"conditions,omitempty"` + Conditions []RuleWithNestedConditionsConditionsItemIntf `json:"conditions,omitempty"` } // Constants associated with the V2PolicyRule.Operator property. @@ -6246,7 +6245,7 @@ func UnmarshalV2PolicyRule(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } - err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleAttributeWithConditions) + err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleWithNestedConditionsConditionsItem) if err != nil { return } @@ -6517,6 +6516,116 @@ func UnmarshalControlResponseControlWithEnrichedRoles(m map[string]json.RawMessa return } +// RuleWithNestedConditionsConditionsItemRuleAttribute : Rule that specifies additional access granted (e.g., time-based condition). +// This model "extends" RuleWithNestedConditionsConditionsItem +type RuleWithNestedConditionsConditionsItemRuleAttribute struct { + // The name of an attribute. + Key *string `json:"key" validate:"required"` + + // The operator of an attribute. + Operator *string `json:"operator" validate:"required"` + + // The value of a rule or resource attribute; can be boolean or string for resource attribute. Can be string or an + // array of strings (e.g., array of days to permit access) for rule attribute. + Value interface{} `json:"value" validate:"required"` +} + +// Constants associated with the RuleWithNestedConditionsConditionsItemRuleAttribute.Operator property. +// The operator of an attribute. +const ( + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimelessthanConst = "dateTimeLessThan" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDayofweekanyofConst = "dayOfWeekAnyOf" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDayofweekequalsConst = "dayOfWeekEquals" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimegreaterthanConst = "timeGreaterThan" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimelessthanConst = "timeLessThan" + RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" +) + +// NewRuleWithNestedConditionsConditionsItemRuleAttribute : Instantiate RuleWithNestedConditionsConditionsItemRuleAttribute (Generic Model Constructor) +func (*IamPolicyManagementV1) NewRuleWithNestedConditionsConditionsItemRuleAttribute(key string, operator string, value interface{}) (_model *RuleWithNestedConditionsConditionsItemRuleAttribute, err error) { + _model = &RuleWithNestedConditionsConditionsItemRuleAttribute{ + Key: core.StringPtr(key), + Operator: core.StringPtr(operator), + Value: value, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RuleWithNestedConditionsConditionsItemRuleAttribute) isaRuleWithNestedConditionsConditionsItem() bool { + return true +} + +// UnmarshalRuleWithNestedConditionsConditionsItemRuleAttribute unmarshals an instance of RuleWithNestedConditionsConditionsItemRuleAttribute from the specified map of raw messages. +func UnmarshalRuleWithNestedConditionsConditionsItemRuleAttribute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RuleWithNestedConditionsConditionsItemRuleAttribute) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RuleWithNestedConditionsConditionsItemRuleWithConditions : Rule that specifies additional access granted (e.g., time-based condition) accross multiple conditions. +// This model "extends" RuleWithNestedConditionsConditionsItem +type RuleWithNestedConditionsConditionsItemRuleWithConditions struct { + // Operator to evaluate conditions. + Operator *string `json:"operator" validate:"required"` + + // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time + // period. + Conditions []RuleAttribute `json:"conditions" validate:"required"` +} + +// Constants associated with the RuleWithNestedConditionsConditionsItemRuleWithConditions.Operator property. +// Operator to evaluate conditions. +const ( + RuleWithNestedConditionsConditionsItemRuleWithConditionsOperatorAndConst = "and" + RuleWithNestedConditionsConditionsItemRuleWithConditionsOperatorOrConst = "or" +) + +// NewRuleWithNestedConditionsConditionsItemRuleWithConditions : Instantiate RuleWithNestedConditionsConditionsItemRuleWithConditions (Generic Model Constructor) +func (*IamPolicyManagementV1) NewRuleWithNestedConditionsConditionsItemRuleWithConditions(operator string, conditions []RuleAttribute) (_model *RuleWithNestedConditionsConditionsItemRuleWithConditions, err error) { + _model = &RuleWithNestedConditionsConditionsItemRuleWithConditions{ + Operator: core.StringPtr(operator), + Conditions: conditions, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RuleWithNestedConditionsConditionsItemRuleWithConditions) isaRuleWithNestedConditionsConditionsItem() bool { + return true +} + +// UnmarshalRuleWithNestedConditionsConditionsItemRuleWithConditions unmarshals an instance of RuleWithNestedConditionsConditionsItemRuleWithConditions from the specified map of raw messages. +func UnmarshalRuleWithNestedConditionsConditionsItemRuleWithConditions(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RuleWithNestedConditionsConditionsItemRuleWithConditions) + err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) + if err != nil { + return + } + err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleAttribute) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // V2PolicyRuleRuleAttribute : Rule that specifies additional access granted (e.g., time-based condition). // This model "extends" V2PolicyRule type V2PolicyRuleRuleAttribute struct { @@ -6580,27 +6689,27 @@ func UnmarshalV2PolicyRuleRuleAttribute(m map[string]json.RawMessage, result int return } -// V2PolicyRuleRuleWithConditions : Rule that specifies additional access granted (e.g., time-based condition) accross multiple conditions. +// V2PolicyRuleRuleWithNestedConditions : Rule that specifies additional access granted (e.g., time-based condition) accross multiple conditions. // This model "extends" V2PolicyRule -type V2PolicyRuleRuleWithConditions struct { +type V2PolicyRuleRuleWithNestedConditions struct { // Operator to evaluate conditions. Operator *string `json:"operator" validate:"required"` // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time // period. - Conditions []RuleAttributeWithConditions `json:"conditions" validate:"required"` + Conditions []RuleWithNestedConditionsConditionsItemIntf `json:"conditions" validate:"required"` } -// Constants associated with the V2PolicyRuleRuleWithConditions.Operator property. +// Constants associated with the V2PolicyRuleRuleWithNestedConditions.Operator property. // Operator to evaluate conditions. const ( - V2PolicyRuleRuleWithConditionsOperatorAndConst = "and" - V2PolicyRuleRuleWithConditionsOperatorOrConst = "or" + V2PolicyRuleRuleWithNestedConditionsOperatorAndConst = "and" + V2PolicyRuleRuleWithNestedConditionsOperatorOrConst = "or" ) -// NewV2PolicyRuleRuleWithConditions : Instantiate V2PolicyRuleRuleWithConditions (Generic Model Constructor) -func (*IamPolicyManagementV1) NewV2PolicyRuleRuleWithConditions(operator string, conditions []RuleAttributeWithConditions) (_model *V2PolicyRuleRuleWithConditions, err error) { - _model = &V2PolicyRuleRuleWithConditions{ +// NewV2PolicyRuleRuleWithNestedConditions : Instantiate V2PolicyRuleRuleWithNestedConditions (Generic Model Constructor) +func (*IamPolicyManagementV1) NewV2PolicyRuleRuleWithNestedConditions(operator string, conditions []RuleWithNestedConditionsConditionsItemIntf) (_model *V2PolicyRuleRuleWithNestedConditions, err error) { + _model = &V2PolicyRuleRuleWithNestedConditions{ Operator: core.StringPtr(operator), Conditions: conditions, } @@ -6608,18 +6717,18 @@ func (*IamPolicyManagementV1) NewV2PolicyRuleRuleWithConditions(operator string, return } -func (*V2PolicyRuleRuleWithConditions) isaV2PolicyRule() bool { +func (*V2PolicyRuleRuleWithNestedConditions) isaV2PolicyRule() bool { return true } -// UnmarshalV2PolicyRuleRuleWithConditions unmarshals an instance of V2PolicyRuleRuleWithConditions from the specified map of raw messages. -func UnmarshalV2PolicyRuleRuleWithConditions(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(V2PolicyRuleRuleWithConditions) +// UnmarshalV2PolicyRuleRuleWithNestedConditions unmarshals an instance of V2PolicyRuleRuleWithNestedConditions from the specified map of raw messages. +func UnmarshalV2PolicyRuleRuleWithNestedConditions(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(V2PolicyRuleRuleWithNestedConditions) err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) if err != nil { return } - err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleAttributeWithConditions) + err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleWithNestedConditionsConditionsItem) if err != nil { return } diff --git a/iampolicymanagementv1/iam_policy_management_v1_examples_test.go b/iampolicymanagementv1/iam_policy_management_v1_examples_test.go index 4e6e7490..6e8941c5 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_examples_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_examples_test.go @@ -371,25 +371,25 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() { *accountIDResourceAttribute, *serviceNameResourceAttribute}, Tags: []iampolicymanagementv1.V2PolicyResourceTag{*policyResourceTag}, } - weeklyConditionAttribute := &iampolicymanagementv1.RuleAttributeWithConditions{ + weeklyConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ Key: core.StringPtr("{{environment.attributes.day_of_week}}"), Operator: core.StringPtr("dayOfWeekAnyOf"), Value: []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"}, } - startConditionAttribute := &iampolicymanagementv1.RuleAttributeWithConditions{ + startConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeGreaterThanOrEquals"), Value: core.StringPtr("09:00:00+00:00"), } - endConditionAttribute := &iampolicymanagementv1.RuleAttributeWithConditions{ + endConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeLessThanOrEquals"), Value: core.StringPtr("17:00:00+00:00"), } policyRule := &iampolicymanagementv1.V2PolicyRule{ Operator: core.StringPtr("and"), - Conditions: []iampolicymanagementv1.RuleAttributeWithConditions{ - *weeklyConditionAttribute, *startConditionAttribute, *endConditionAttribute}, + Conditions: []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{ + weeklyConditionAttribute, startConditionAttribute, endConditionAttribute}, } options := iamPolicyManagementService.NewCreateV2PolicyOptions( @@ -481,25 +481,25 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() { v2PolicyControl, "access", ) - weeklyConditionAttribute := &iampolicymanagementv1.RuleAttributeWithConditions{ + weeklyConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ Key: core.StringPtr("{{environment.attributes.day_of_week}}"), Operator: core.StringPtr("dayOfWeekAnyOf"), Value: []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00"}, } - startConditionAttribute := &iampolicymanagementv1.RuleAttributeWithConditions{ + startConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeGreaterThanOrEquals"), Value: core.StringPtr("09:00:00+00:00"), } - endConditionAttribute := &iampolicymanagementv1.RuleAttributeWithConditions{ + endConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeLessThanOrEquals"), Value: core.StringPtr("17:00:00+00:00"), } policyRule := &iampolicymanagementv1.V2PolicyRule{ Operator: core.StringPtr("and"), - Conditions: []iampolicymanagementv1.RuleAttributeWithConditions{ - *weeklyConditionAttribute, *startConditionAttribute, *endConditionAttribute}, + Conditions: []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{ + weeklyConditionAttribute, startConditionAttribute, endConditionAttribute}, } options.SetRule(policyRule) options.SetPattern(*core.StringPtr("time-based-conditions:weekly:custom-hours")) diff --git a/iampolicymanagementv1/iam_policy_management_v1_integration_test.go b/iampolicymanagementv1/iam_policy_management_v1_integration_test.go index 517ea767..8aa321eb 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_integration_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_integration_test.go @@ -348,24 +348,24 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() { control.Grant = grant // Construct an instance of Policy Rule Attribute - weeklyConditionAttribute := new(iampolicymanagementv1.RuleAttributeWithConditions) + weeklyConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) weeklyConditionAttribute.Key = core.StringPtr("{{environment.attributes.day_of_week}}") weeklyConditionAttribute.Operator = core.StringPtr("dayOfWeekAnyOf") weeklyConditionAttribute.Value = []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"} - startConditionAttribute := new(iampolicymanagementv1.RuleAttributeWithConditions) + startConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) startConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") startConditionAttribute.Operator = core.StringPtr("timeGreaterThanOrEquals") startConditionAttribute.Value = core.StringPtr("09:00:00+00:00") - endConditionAttribute := new(iampolicymanagementv1.RuleAttributeWithConditions) + endConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) endConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") endConditionAttribute.Operator = core.StringPtr("timeLessThanOrEquals") endConditionAttribute.Value = core.StringPtr("17:00:00+00:00") policyRule := new(iampolicymanagementv1.V2PolicyRule) policyRule.Operator = core.StringPtr("and") - policyRule.Conditions = []iampolicymanagementv1.RuleAttributeWithConditions{*weeklyConditionAttribute, *startConditionAttribute, *endConditionAttribute} + policyRule.Conditions = []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{weeklyConditionAttribute, startConditionAttribute, endConditionAttribute} // Construct an instance of the CreateV2PolicyOptions model options := new(iampolicymanagementv1.CreateV2PolicyOptions) @@ -454,24 +454,26 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() { control.Grant = grant // Construct an instance of Policy Rule Attribute - weeklyConditionAttribute := new(iampolicymanagementv1.RuleAttributeWithConditions) + weeklyConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) weeklyConditionAttribute.Key = core.StringPtr("{{environment.attributes.day_of_week}}") weeklyConditionAttribute.Operator = core.StringPtr("dayOfWeekAnyOf") weeklyConditionAttribute.Value = []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"} - startConditionAttribute := new(iampolicymanagementv1.RuleAttributeWithConditions) + startConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) startConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") startConditionAttribute.Operator = core.StringPtr("timeGreaterThanOrEquals") startConditionAttribute.Value = core.StringPtr("09:00:00+00:00") - endConditionAttribute := new(iampolicymanagementv1.RuleAttributeWithConditions) + endConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) endConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") endConditionAttribute.Operator = core.StringPtr("timeLessThanOrEquals") endConditionAttribute.Value = core.StringPtr("17:00:00+00:00") policyRule := new(iampolicymanagementv1.V2PolicyRule) policyRule.Operator = core.StringPtr("and") - policyRule.Conditions = []iampolicymanagementv1.RuleAttributeWithConditions{*weeklyConditionAttribute, *startConditionAttribute, *endConditionAttribute} + // ruleCondtions := make([]iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf, 0) + // ruleCondtions = append(ruleCondtions, endConditionAttribute) + policyRule.Conditions = []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{weeklyConditionAttribute, startConditionAttribute, endConditionAttribute} // Construct an instance of the ReplaceV2PolicyOptions model options := new(iampolicymanagementv1.ReplaceV2PolicyOptions) diff --git a/iampolicymanagementv1/iam_policy_management_v1_test.go b/iampolicymanagementv1/iam_policy_management_v1_test.go index c0abcb4c..c2c3e46f 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_test.go @@ -8535,12 +8535,6 @@ var _ = Describe(`IamPolicyManagementV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewRuleAttributeWithConditions successfully`, func() { - operator := "timeLessThan" - _model, err := iamPolicyManagementService.NewRuleAttributeWithConditions(operator) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) It(`Invoke NewSubjectAttribute successfully`, func() { name := "testString" value := "testString" @@ -8605,6 +8599,21 @@ var _ = Describe(`IamPolicyManagementV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewRuleWithNestedConditionsConditionsItemRuleAttribute successfully`, func() { + key := "testString" + operator := "timeLessThan" + value := core.StringPtr("testString") + _model, err := iamPolicyManagementService.NewRuleWithNestedConditionsConditionsItemRuleAttribute(key, operator, value) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRuleWithNestedConditionsConditionsItemRuleWithConditions successfully`, func() { + operator := "and" + conditions := []iampolicymanagementv1.RuleAttribute{} + _model, err := iamPolicyManagementService.NewRuleWithNestedConditionsConditionsItemRuleWithConditions(operator, conditions) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewV2PolicyRuleRuleAttribute successfully`, func() { key := "testString" operator := "timeLessThan" @@ -8613,10 +8622,10 @@ var _ = Describe(`IamPolicyManagementV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewV2PolicyRuleRuleWithConditions successfully`, func() { + It(`Invoke NewV2PolicyRuleRuleWithNestedConditions successfully`, func() { operator := "and" - conditions := []iampolicymanagementv1.RuleAttributeWithConditions{} - _model, err := iamPolicyManagementService.NewV2PolicyRuleRuleWithConditions(operator, conditions) + conditions := []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{} + _model, err := iamPolicyManagementService.NewV2PolicyRuleRuleWithNestedConditions(operator, conditions) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) From a7f5cf1ab2765f0d96a71d2f4eda8549cb6480ae Mon Sep 17 00:00:00 2001 From: Shaun Colley Date: Tue, 7 Nov 2023 10:17:04 -0500 Subject: [PATCH 2/2] fix(IAM Policy Management): Update based on feedback/API definition changes Signed-off-by: Shaun Colley --- .../iam_policy_management_v1.go | 561 +++++++++--------- .../iam_policy_management_v1_examples_test.go | 16 +- ...m_policy_management_v1_integration_test.go | 18 +- .../iam_policy_management_v1_test.go | 25 +- 4 files changed, 317 insertions(+), 303 deletions(-) diff --git a/iampolicymanagementv1/iam_policy_management_v1.go b/iampolicymanagementv1/iam_policy_management_v1.go index 3cfa2dc3..55c8bffe 100644 --- a/iampolicymanagementv1/iam_policy_management_v1.go +++ b/iampolicymanagementv1/iam_policy_management_v1.go @@ -277,7 +277,9 @@ func (iamPolicyManagement *IamPolicyManagementV1) ListPoliciesWithContext(ctx co // their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in the // body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject // attributes might be provided. The following attributes are supported: -// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// +// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// // supported by the service or platform roles. For more information, see [IAM roles and // actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or // greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. @@ -395,7 +397,9 @@ func (iamPolicyManagement *IamPolicyManagementV1) CreatePolicyWithContext(ctx co // To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match // the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following // attributes are supported: -// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// +// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// // supported by the service or platform roles. For more information, see [IAM roles and // actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or // greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. @@ -1142,27 +1146,31 @@ func (iamPolicyManagement *IamPolicyManagementV1) ListV2PoliciesWithContext(ctx // specify a time-based restriction (e.g., access only during business hours, during the Monday-Friday work week). For // example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following rule: // ```json -// "rule": { -// "operator": "and", -// "conditions": [{ -// "key": "{{environment.attributes.day_of_week}}", -// "operator": "dayOfWeekAnyOf", -// "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] -// }, -// "key": "{{environment.attributes.current_time}}", -// "operator": "timeGreaterThanOrEquals", -// "value": "09:00:00+00:00" -// }, -// "key": "{{environment.attributes.current_time}}", -// "operator": "timeLessThanOrEquals", -// "value": "17:00:00+00:00" -// }] -// } +// +// "rule": { +// "operator": "and", +// "conditions": [{ +// "key": "{{environment.attributes.day_of_week}}", +// "operator": "dayOfWeekAnyOf", +// "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] +// }, +// "key": "{{environment.attributes.current_time}}", +// "operator": "timeGreaterThanOrEquals", +// "value": "09:00:00+00:00" +// }, +// "key": "{{environment.attributes.current_time}}", +// "operator": "timeLessThanOrEquals", +// "value": "17:00:00+00:00" +// }] +// } +// // ``` You can use the following operators in the **`key`** and **`value`** pair: // ``` -// 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', -// 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', -// 'dayOfWeekEquals', 'dayOfWeekAnyOf', +// +// 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', +// 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', +// 'dayOfWeekEquals', 'dayOfWeekAnyOf', +// // ``` // // The pattern field that matches the rule is required when rule is provided. For the business hour rule example above, @@ -1179,7 +1187,9 @@ func (iamPolicyManagement *IamPolicyManagementV1) ListV2PoliciesWithContext(ctx // their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in the // body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject // attributes might be provided. The following attributes are supported: -// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// +// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// // supported by the service or platform roles. For more information, see [IAM roles and // actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or // greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. @@ -1301,27 +1311,31 @@ func (iamPolicyManagement *IamPolicyManagementV1) CreateV2PolicyWithContext(ctx // specify a time-based restriction (e.g., access only during business hours, during the Monday-Friday work week). For // example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following rule: // ```json -// "rule": { -// "operator": "and", -// "conditions": [{ -// "key": "{{environment.attributes.day_of_week}}", -// "operator": "dayOfWeekAnyOf", -// "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] -// }, -// "key": "{{environment.attributes.current_time}}", -// "operator": "timeGreaterThanOrEquals", -// "value": "09:00:00+00:00" -// }, -// "key": "{{environment.attributes.current_time}}", -// "operator": "timeLessThanOrEquals", -// "value": "17:00:00+00:00" -// }] -// } +// +// "rule": { +// "operator": "and", +// "conditions": [{ +// "key": "{{environment.attributes.day_of_week}}", +// "operator": "dayOfWeekAnyOf", +// "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] +// }, +// "key": "{{environment.attributes.current_time}}", +// "operator": "timeGreaterThanOrEquals", +// "value": "09:00:00+00:00" +// }, +// "key": "{{environment.attributes.current_time}}", +// "operator": "timeLessThanOrEquals", +// "value": "17:00:00+00:00" +// }] +// } +// // ``` You can use the following operators in the **`key`**, **`value`** pair: // ``` -// 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', -// 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', -// 'dayOfWeekEquals', 'dayOfWeekAnyOf', +// +// 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', +// 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', +// 'dayOfWeekEquals', 'dayOfWeekAnyOf', +// // ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example // above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions // operators](https://cloud.ibm.com/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) @@ -1334,7 +1348,9 @@ func (iamPolicyManagement *IamPolicyManagementV1) CreateV2PolicyWithContext(ctx // To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match // the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following // attributes are supported: -// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// +// serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are +// // supported by the service or platform roles. For more information, see [IAM roles and // actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or // greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. @@ -1970,7 +1986,7 @@ func (iamPolicyManagement *IamPolicyManagementV1) ReplacePolicyTemplateWithConte pathParamsMap := map[string]string{ "policy_template_id": *replacePolicyTemplateOptions.PolicyTemplateID, - "version": *replacePolicyTemplateOptions.Version, + "version": *replacePolicyTemplateOptions.Version, } builder := core.NewRequestBuilder(core.PUT) @@ -2055,7 +2071,7 @@ func (iamPolicyManagement *IamPolicyManagementV1) DeletePolicyTemplateVersionWit pathParamsMap := map[string]string{ "policy_template_id": *deletePolicyTemplateVersionOptions.PolicyTemplateID, - "version": *deletePolicyTemplateVersionOptions.Version, + "version": *deletePolicyTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.DELETE) @@ -2104,7 +2120,7 @@ func (iamPolicyManagement *IamPolicyManagementV1) GetPolicyTemplateVersionWithCo pathParamsMap := map[string]string{ "policy_template_id": *getPolicyTemplateVersionOptions.PolicyTemplateID, - "version": *getPolicyTemplateVersionOptions.Version, + "version": *getPolicyTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.GET) @@ -2166,7 +2182,7 @@ func (iamPolicyManagement *IamPolicyManagementV1) CommitPolicyTemplateWithContex pathParamsMap := map[string]string{ "policy_template_id": *commitPolicyTemplateOptions.PolicyTemplateID, - "version": *commitPolicyTemplateOptions.Version, + "version": *commitPolicyTemplateOptions.Version, } builder := core.NewRequestBuilder(core.POST) @@ -2360,7 +2376,7 @@ type CommitPolicyTemplateOptions struct { func (*IamPolicyManagementV1) NewCommitPolicyTemplateOptions(policyTemplateID string, version string) *CommitPolicyTemplateOptions { return &CommitPolicyTemplateOptions{ PolicyTemplateID: core.StringPtr(policyTemplateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -2447,6 +2463,7 @@ type ControlResponse struct { // Permission granted by the policy. Grant *Grant `json:"grant,omitempty"` } + func (*ControlResponse) isaControlResponse() bool { return true } @@ -2504,9 +2521,9 @@ type CreatePolicyOptions struct { // NewCreatePolicyOptions : Instantiate CreatePolicyOptions func (*IamPolicyManagementV1) NewCreatePolicyOptions(typeVar string, subjects []PolicySubject, roles []PolicyRole, resources []PolicyResource) *CreatePolicyOptions { return &CreatePolicyOptions{ - Type: core.StringPtr(typeVar), - Subjects: subjects, - Roles: roles, + Type: core.StringPtr(typeVar), + Subjects: subjects, + Roles: roles, Resources: resources, } } @@ -2593,9 +2610,9 @@ type CreatePolicyTemplateOptions struct { // NewCreatePolicyTemplateOptions : Instantiate CreatePolicyTemplateOptions func (*IamPolicyManagementV1) NewCreatePolicyTemplateOptions(name string, accountID string, policy *TemplatePolicy) *CreatePolicyTemplateOptions { return &CreatePolicyTemplateOptions{ - Name: core.StringPtr(name), + Name: core.StringPtr(name), AccountID: core.StringPtr(accountID), - Policy: policy, + Policy: policy, } } @@ -2668,7 +2685,7 @@ type CreatePolicyTemplateVersionOptions struct { func (*IamPolicyManagementV1) NewCreatePolicyTemplateVersionOptions(policyTemplateID string, policy *TemplatePolicy) *CreatePolicyTemplateVersionOptions { return &CreatePolicyTemplateVersionOptions{ PolicyTemplateID: core.StringPtr(policyTemplateID), - Policy: policy, + Policy: policy, } } @@ -2751,9 +2768,9 @@ type CreateRoleOptions struct { func (*IamPolicyManagementV1) NewCreateRoleOptions(displayName string, actions []string, name string, accountID string, serviceName string) *CreateRoleOptions { return &CreateRoleOptions{ DisplayName: core.StringPtr(displayName), - Actions: actions, - Name: core.StringPtr(name), - AccountID: core.StringPtr(accountID), + Actions: actions, + Name: core.StringPtr(name), + AccountID: core.StringPtr(accountID), ServiceName: core.StringPtr(serviceName), } } @@ -2851,7 +2868,7 @@ type CreateV2PolicyOptions struct { // Constants associated with the CreateV2PolicyOptions.Type property. // The policy type; either 'access' or 'authorization'. const ( - CreateV2PolicyOptionsTypeAccessConst = "access" + CreateV2PolicyOptionsTypeAccessConst = "access" CreateV2PolicyOptionsTypeAuthorizationConst = "authorization" ) @@ -2859,7 +2876,7 @@ const ( func (*IamPolicyManagementV1) NewCreateV2PolicyOptions(control *Control, typeVar string) *CreateV2PolicyOptions { return &CreateV2PolicyOptions{ Control: control, - Type: core.StringPtr(typeVar), + Type: core.StringPtr(typeVar), } } @@ -3092,7 +3109,7 @@ type DeletePolicyTemplateVersionOptions struct { func (*IamPolicyManagementV1) NewDeletePolicyTemplateVersionOptions(policyTemplateID string, version string) *DeletePolicyTemplateVersionOptions { return &DeletePolicyTemplateVersionOptions{ PolicyTemplateID: core.StringPtr(policyTemplateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -3245,23 +3262,23 @@ type ErrorObject struct { // Constants associated with the ErrorObject.Code property. // The API error code for the error. const ( - ErrorObjectCodeInsufficentPermissionsConst = "insufficent_permissions" - ErrorObjectCodeInvalidBodyConst = "invalid_body" - ErrorObjectCodeInvalidTokenConst = "invalid_token" + ErrorObjectCodeInsufficentPermissionsConst = "insufficent_permissions" + ErrorObjectCodeInvalidBodyConst = "invalid_body" + ErrorObjectCodeInvalidTokenConst = "invalid_token" ErrorObjectCodeMissingRequiredQueryParameterConst = "missing_required_query_parameter" - ErrorObjectCodeNotFoundConst = "not_found" + ErrorObjectCodeNotFoundConst = "not_found" ErrorObjectCodePolicyAssignmentConflictErrorConst = "policy_assignment_conflict_error" - ErrorObjectCodePolicyAssignmentNotFoundConst = "policy_assignment_not_found" - ErrorObjectCodePolicyConflictErrorConst = "policy_conflict_error" - ErrorObjectCodePolicyNotFoundConst = "policy_not_found" - ErrorObjectCodePolicyTemplateConflictErrorConst = "policy_template_conflict_error" - ErrorObjectCodePolicyTemplateNotFoundConst = "policy_template_not_found" - ErrorObjectCodeRequestNotProcessedConst = "request_not_processed" - ErrorObjectCodeRoleConflictErrorConst = "role_conflict_error" - ErrorObjectCodeRoleNotFoundConst = "role_not_found" - ErrorObjectCodeTooManyRequestsConst = "too_many_requests" - ErrorObjectCodeUnableToProcessConst = "unable_to_process" - ErrorObjectCodeUnsupportedContentTypeConst = "unsupported_content_type" + ErrorObjectCodePolicyAssignmentNotFoundConst = "policy_assignment_not_found" + ErrorObjectCodePolicyConflictErrorConst = "policy_conflict_error" + ErrorObjectCodePolicyNotFoundConst = "policy_not_found" + ErrorObjectCodePolicyTemplateConflictErrorConst = "policy_template_conflict_error" + ErrorObjectCodePolicyTemplateNotFoundConst = "policy_template_not_found" + ErrorObjectCodeRequestNotProcessedConst = "request_not_processed" + ErrorObjectCodeRoleConflictErrorConst = "role_conflict_error" + ErrorObjectCodeRoleNotFoundConst = "role_not_found" + ErrorObjectCodeTooManyRequestsConst = "too_many_requests" + ErrorObjectCodeUnableToProcessConst = "unable_to_process" + ErrorObjectCodeUnsupportedContentTypeConst = "unsupported_content_type" ) // UnmarshalErrorObject unmarshals an instance of ErrorObject from the specified map of raw messages. @@ -3418,7 +3435,7 @@ type GetPolicyTemplateVersionOptions struct { func (*IamPolicyManagementV1) NewGetPolicyTemplateVersionOptions(policyTemplateID string, version string) *GetPolicyTemplateVersionOptions { return &GetPolicyTemplateVersionOptions{ PolicyTemplateID: core.StringPtr(policyTemplateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -3491,7 +3508,7 @@ type GetV2PolicyOptions struct { // * `display` - returns the list of all actions included in each of the policy roles and translations for all relevant // fields. const ( - GetV2PolicyOptionsFormatDisplayConst = "display" + GetV2PolicyOptionsFormatDisplayConst = "display" GetV2PolicyOptionsFormatIncludeLastPermitConst = "include_last_permit" ) @@ -3646,7 +3663,7 @@ type ListPoliciesOptions struct { // Constants associated with the ListPoliciesOptions.Type property. // Optional type of policy. const ( - ListPoliciesOptionsTypeAccessConst = "access" + ListPoliciesOptionsTypeAccessConst = "access" ListPoliciesOptionsTypeAuthorizationConst = "authorization" ) @@ -3654,21 +3671,21 @@ const ( // Optional type of service. const ( ListPoliciesOptionsServiceTypePlatformServiceConst = "platform_service" - ListPoliciesOptionsServiceTypeServiceConst = "service" + ListPoliciesOptionsServiceTypeServiceConst = "service" ) // Constants associated with the ListPoliciesOptions.Sort property. // Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending // '-' to field. Example '-last_modified_at'. const ( - ListPoliciesOptionsSortCreatedAtConst = "created_at" - ListPoliciesOptionsSortCreatedByIDConst = "created_by_id" - ListPoliciesOptionsSortHrefConst = "href" - ListPoliciesOptionsSortIDConst = "id" - ListPoliciesOptionsSortLastModifiedAtConst = "last_modified_at" + ListPoliciesOptionsSortCreatedAtConst = "created_at" + ListPoliciesOptionsSortCreatedByIDConst = "created_by_id" + ListPoliciesOptionsSortHrefConst = "href" + ListPoliciesOptionsSortIDConst = "id" + ListPoliciesOptionsSortLastModifiedAtConst = "last_modified_at" ListPoliciesOptionsSortLastModifiedByIDConst = "last_modified_by_id" - ListPoliciesOptionsSortStateConst = "state" - ListPoliciesOptionsSortTypeConst = "type" + ListPoliciesOptionsSortStateConst = "state" + ListPoliciesOptionsSortTypeConst = "type" ) // Constants associated with the ListPoliciesOptions.Format property. @@ -3677,7 +3694,7 @@ const ( // it has done so // * `display` - returns the list of all actions included in each of the policy roles. const ( - ListPoliciesOptionsFormatDisplayConst = "display" + ListPoliciesOptionsFormatDisplayConst = "display" ListPoliciesOptionsFormatIncludeLastPermitConst = "include_last_permit" ) @@ -3686,7 +3703,7 @@ const ( // * `active` - returns active policies // * `deleted` - returns non-active policies. const ( - ListPoliciesOptionsStateActiveConst = "active" + ListPoliciesOptionsStateActiveConst = "active" ListPoliciesOptionsStateDeletedConst = "deleted" ) @@ -4065,7 +4082,7 @@ type ListV2PoliciesOptions struct { // Constants associated with the ListV2PoliciesOptions.Type property. // Optional type of policy. const ( - ListV2PoliciesOptionsTypeAccessConst = "access" + ListV2PoliciesOptionsTypeAccessConst = "access" ListV2PoliciesOptionsTypeAuthorizationConst = "authorization" ) @@ -4073,7 +4090,7 @@ const ( // Optional type of service. const ( ListV2PoliciesOptionsServiceTypePlatformServiceConst = "platform_service" - ListV2PoliciesOptionsServiceTypeServiceConst = "service" + ListV2PoliciesOptionsServiceTypeServiceConst = "service" ) // Constants associated with the ListV2PoliciesOptions.Format property. @@ -4083,7 +4100,7 @@ const ( // * `display` - returns the list of all actions included in each of the policy roles and translations for all relevant // fields. const ( - ListV2PoliciesOptionsFormatDisplayConst = "display" + ListV2PoliciesOptionsFormatDisplayConst = "display" ListV2PoliciesOptionsFormatIncludeLastPermitConst = "include_last_permit" ) @@ -4092,7 +4109,7 @@ const ( // * `active` - returns active policies // * `deleted` - returns non-active policies. const ( - ListV2PoliciesOptionsStateActiveConst = "active" + ListV2PoliciesOptionsStateActiveConst = "active" ListV2PoliciesOptionsStateDeletedConst = "deleted" ) @@ -4175,6 +4192,72 @@ func (options *ListV2PoliciesOptions) SetHeaders(param map[string]string) *ListV return options } +// NestedCondition : Condition that specifies additional conditions or RuleAttribute to grant access.s. +// Models which "extend" this model: +// - NestedConditionRuleAttribute +// - NestedConditionRuleWithConditions +type NestedCondition struct { + // The name of an attribute. + Key *string `json:"key,omitempty"` + + // The operator of an attribute. + Operator *string `json:"operator,omitempty"` + + // The value of a rule or resource attribute; can be boolean or string for resource attribute. Can be string or an + // array of strings (e.g., array of days to permit access) for rule attribute. + Value interface{} `json:"value,omitempty"` + + // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time + // period. + Conditions []RuleAttribute `json:"conditions,omitempty"` +} + +// Constants associated with the NestedCondition.Operator property. +// The operator of an attribute. +const ( + NestedConditionOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" + NestedConditionOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" + NestedConditionOperatorDatetimelessthanConst = "dateTimeLessThan" + NestedConditionOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" + NestedConditionOperatorDayofweekanyofConst = "dayOfWeekAnyOf" + NestedConditionOperatorDayofweekequalsConst = "dayOfWeekEquals" + NestedConditionOperatorTimegreaterthanConst = "timeGreaterThan" + NestedConditionOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" + NestedConditionOperatorTimelessthanConst = "timeLessThan" + NestedConditionOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" +) + +func (*NestedCondition) isaNestedCondition() bool { + return true +} + +type NestedConditionIntf interface { + isaNestedCondition() bool +} + +// UnmarshalNestedCondition unmarshals an instance of NestedCondition from the specified map of raw messages. +func UnmarshalNestedCondition(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NestedCondition) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleAttribute) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // Policy : The core set of properties associated with a policy. type Policy struct { // The policy ID. @@ -4217,7 +4300,7 @@ type Policy struct { // Constants associated with the Policy.State property. // The policy state. const ( - PolicyStateActiveConst = "active" + PolicyStateActiveConst = "active" PolicyStateDeletedConst = "deleted" ) @@ -4333,10 +4416,10 @@ const ( // Constants associated with the PolicyAssignment.Status property. // The policy assignment status. const ( - PolicyAssignmentStatusFailedConst = "failed" - PolicyAssignmentStatusInProgressConst = "in_progress" + PolicyAssignmentStatusFailedConst = "failed" + PolicyAssignmentStatusInProgressConst = "in_progress" PolicyAssignmentStatusSucceedWithErrorsConst = "succeed_with_errors" - PolicyAssignmentStatusSucceededConst = "succeeded" + PolicyAssignmentStatusSucceededConst = "succeeded" ) // UnmarshalPolicyAssignment unmarshals an instance of PolicyAssignment from the specified map of raw messages. @@ -4428,7 +4511,7 @@ type PolicyAssignmentOptions struct { // The policy subject type; either 'iam_id' or 'access_group_id'. const ( PolicyAssignmentOptionsSubjectTypeAccessGroupIDConst = "access_group_id" - PolicyAssignmentOptionsSubjectTypeIamIDConst = "iam_id" + PolicyAssignmentOptionsSubjectTypeIamIDConst = "iam_id" ) // UnmarshalPolicyAssignmentOptions unmarshals an instance of PolicyAssignmentOptions from the specified map of raw messages. @@ -4890,7 +4973,7 @@ type PolicyTemplateMetaData struct { // Constants associated with the PolicyTemplateMetaData.State property. // The policy state. const ( - PolicyTemplateMetaDataStateActiveConst = "active" + PolicyTemplateMetaDataStateActiveConst = "active" PolicyTemplateMetaDataStateDeletedConst = "deleted" ) @@ -5001,11 +5084,11 @@ type ReplacePolicyOptions struct { // NewReplacePolicyOptions : Instantiate ReplacePolicyOptions func (*IamPolicyManagementV1) NewReplacePolicyOptions(policyID string, ifMatch string, typeVar string, subjects []PolicySubject, roles []PolicyRole, resources []PolicyResource) *ReplacePolicyOptions { return &ReplacePolicyOptions{ - PolicyID: core.StringPtr(policyID), - IfMatch: core.StringPtr(ifMatch), - Type: core.StringPtr(typeVar), - Subjects: subjects, - Roles: roles, + PolicyID: core.StringPtr(policyID), + IfMatch: core.StringPtr(ifMatch), + Type: core.StringPtr(typeVar), + Subjects: subjects, + Roles: roles, Resources: resources, } } @@ -5093,9 +5176,9 @@ type ReplacePolicyTemplateOptions struct { func (*IamPolicyManagementV1) NewReplacePolicyTemplateOptions(policyTemplateID string, version string, ifMatch string, policy *TemplatePolicy) *ReplacePolicyTemplateOptions { return &ReplacePolicyTemplateOptions{ PolicyTemplateID: core.StringPtr(policyTemplateID), - Version: core.StringPtr(version), - IfMatch: core.StringPtr(ifMatch), - Policy: policy, + Version: core.StringPtr(version), + IfMatch: core.StringPtr(ifMatch), + Policy: policy, } } @@ -5173,10 +5256,10 @@ type ReplaceRoleOptions struct { // NewReplaceRoleOptions : Instantiate ReplaceRoleOptions func (*IamPolicyManagementV1) NewReplaceRoleOptions(roleID string, ifMatch string, displayName string, actions []string) *ReplaceRoleOptions { return &ReplaceRoleOptions{ - RoleID: core.StringPtr(roleID), - IfMatch: core.StringPtr(ifMatch), + RoleID: core.StringPtr(roleID), + IfMatch: core.StringPtr(ifMatch), DisplayName: core.StringPtr(displayName), - Actions: actions, + Actions: actions, } } @@ -5254,17 +5337,17 @@ type ReplaceV2PolicyOptions struct { // Constants associated with the ReplaceV2PolicyOptions.Type property. // The policy type; either 'access' or 'authorization'. const ( - ReplaceV2PolicyOptionsTypeAccessConst = "access" + ReplaceV2PolicyOptionsTypeAccessConst = "access" ReplaceV2PolicyOptionsTypeAuthorizationConst = "authorization" ) // NewReplaceV2PolicyOptions : Instantiate ReplaceV2PolicyOptions func (*IamPolicyManagementV1) NewReplaceV2PolicyOptions(id string, ifMatch string, control *Control, typeVar string) *ReplaceV2PolicyOptions { return &ReplaceV2PolicyOptions{ - ID: core.StringPtr(id), + ID: core.StringPtr(id), IfMatch: core.StringPtr(ifMatch), Control: control, - Type: core.StringPtr(typeVar), + Type: core.StringPtr(typeVar), } } @@ -5343,7 +5426,7 @@ type ResourceAttribute struct { // NewResourceAttribute : Instantiate ResourceAttribute (Generic Model Constructor) func (*IamPolicyManagementV1) NewResourceAttribute(name string, value string) (_model *ResourceAttribute, err error) { _model = &ResourceAttribute{ - Name: core.StringPtr(name), + Name: core.StringPtr(name), Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") @@ -5384,7 +5467,7 @@ type ResourceTag struct { // NewResourceTag : Instantiate ResourceTag (Generic Model Constructor) func (*IamPolicyManagementV1) NewResourceTag(name string, value string) (_model *ResourceTag, err error) { _model = &ResourceTag{ - Name: core.StringPtr(name), + Name: core.StringPtr(name), Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") @@ -5431,7 +5514,7 @@ type Role struct { func (*IamPolicyManagementV1) NewRole(displayName string, actions []string) (_model *Role, err error) { _model = &Role{ DisplayName: core.StringPtr(displayName), - Actions: actions, + Actions: actions, } err = core.ValidateStruct(_model, "required parameters") return @@ -5564,24 +5647,24 @@ type RuleAttribute struct { // Constants associated with the RuleAttribute.Operator property. // The operator of an attribute. const ( - RuleAttributeOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" + RuleAttributeOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" RuleAttributeOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" - RuleAttributeOperatorDatetimelessthanConst = "dateTimeLessThan" - RuleAttributeOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" - RuleAttributeOperatorDayofweekanyofConst = "dayOfWeekAnyOf" - RuleAttributeOperatorDayofweekequalsConst = "dayOfWeekEquals" - RuleAttributeOperatorTimegreaterthanConst = "timeGreaterThan" - RuleAttributeOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" - RuleAttributeOperatorTimelessthanConst = "timeLessThan" - RuleAttributeOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" + RuleAttributeOperatorDatetimelessthanConst = "dateTimeLessThan" + RuleAttributeOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" + RuleAttributeOperatorDayofweekanyofConst = "dayOfWeekAnyOf" + RuleAttributeOperatorDayofweekequalsConst = "dayOfWeekEquals" + RuleAttributeOperatorTimegreaterthanConst = "timeGreaterThan" + RuleAttributeOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" + RuleAttributeOperatorTimelessthanConst = "timeLessThan" + RuleAttributeOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" ) // NewRuleAttribute : Instantiate RuleAttribute (Generic Model Constructor) func (*IamPolicyManagementV1) NewRuleAttribute(key string, operator string, value interface{}) (_model *RuleAttribute, err error) { _model = &RuleAttribute{ - Key: core.StringPtr(key), + Key: core.StringPtr(key), Operator: core.StringPtr(operator), - Value: value, + Value: value, } err = core.ValidateStruct(_model, "required parameters") return @@ -5606,71 +5689,6 @@ func UnmarshalRuleAttribute(m map[string]json.RawMessage, result interface{}) (e return } -// RuleWithNestedConditionsConditionsItem : RuleWithNestedConditionsConditionsItem struct -// Models which "extend" this model: -// - RuleWithNestedConditionsConditionsItemRuleAttribute -// - RuleWithNestedConditionsConditionsItemRuleWithConditions -type RuleWithNestedConditionsConditionsItem struct { - // The name of an attribute. - Key *string `json:"key,omitempty"` - - // The operator of an attribute. - Operator *string `json:"operator,omitempty"` - - // The value of a rule or resource attribute; can be boolean or string for resource attribute. Can be string or an - // array of strings (e.g., array of days to permit access) for rule attribute. - Value interface{} `json:"value,omitempty"` - - // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time - // period. - Conditions []RuleAttribute `json:"conditions,omitempty"` -} - -// Constants associated with the RuleWithNestedConditionsConditionsItem.Operator property. -// The operator of an attribute. -const ( - RuleWithNestedConditionsConditionsItemOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" - RuleWithNestedConditionsConditionsItemOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" - RuleWithNestedConditionsConditionsItemOperatorDatetimelessthanConst = "dateTimeLessThan" - RuleWithNestedConditionsConditionsItemOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" - RuleWithNestedConditionsConditionsItemOperatorDayofweekanyofConst = "dayOfWeekAnyOf" - RuleWithNestedConditionsConditionsItemOperatorDayofweekequalsConst = "dayOfWeekEquals" - RuleWithNestedConditionsConditionsItemOperatorTimegreaterthanConst = "timeGreaterThan" - RuleWithNestedConditionsConditionsItemOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" - RuleWithNestedConditionsConditionsItemOperatorTimelessthanConst = "timeLessThan" - RuleWithNestedConditionsConditionsItemOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" -) -func (*RuleWithNestedConditionsConditionsItem) isaRuleWithNestedConditionsConditionsItem() bool { - return true -} - -type RuleWithNestedConditionsConditionsItemIntf interface { - isaRuleWithNestedConditionsConditionsItem() bool -} - -// UnmarshalRuleWithNestedConditionsConditionsItem unmarshals an instance of RuleWithNestedConditionsConditionsItem from the specified map of raw messages. -func UnmarshalRuleWithNestedConditionsConditionsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RuleWithNestedConditionsConditionsItem) - err = core.UnmarshalPrimitive(m, "key", &obj.Key) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleAttribute) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SubjectAttribute : An attribute associated with a subject. type SubjectAttribute struct { // The name of an attribute. @@ -5683,7 +5701,7 @@ type SubjectAttribute struct { // NewSubjectAttribute : Instantiate SubjectAttribute (Generic Model Constructor) func (*IamPolicyManagementV1) NewSubjectAttribute(name string, value string) (_model *SubjectAttribute, err error) { _model = &SubjectAttribute{ - Name: core.StringPtr(name), + Name: core.StringPtr(name), Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") @@ -5801,14 +5819,14 @@ type TemplatePolicy struct { // Constants associated with the TemplatePolicy.Type property. // The policy type; either 'access' or 'authorization'. const ( - TemplatePolicyTypeAccessConst = "access" + TemplatePolicyTypeAccessConst = "access" TemplatePolicyTypeAuthorizationConst = "authorization" ) // NewTemplatePolicy : Instantiate TemplatePolicy (Generic Model Constructor) func (*IamPolicyManagementV1) NewTemplatePolicy(typeVar string, control *Control) (_model *TemplatePolicy, err error) { _model = &TemplatePolicy{ - Type: core.StringPtr(typeVar), + Type: core.StringPtr(typeVar), Control: control, } err = core.ValidateStruct(_model, "required parameters") @@ -5865,7 +5883,7 @@ type UpdatePolicyStateOptions struct { // Constants associated with the UpdatePolicyStateOptions.State property. // The policy state. const ( - UpdatePolicyStateOptionsStateActiveConst = "active" + UpdatePolicyStateOptionsStateActiveConst = "active" UpdatePolicyStateOptionsStateDeletedConst = "deleted" ) @@ -5873,7 +5891,7 @@ const ( func (*IamPolicyManagementV1) NewUpdatePolicyStateOptions(policyID string, ifMatch string) *UpdatePolicyStateOptions { return &UpdatePolicyStateOptions{ PolicyID: core.StringPtr(policyID), - IfMatch: core.StringPtr(ifMatch), + IfMatch: core.StringPtr(ifMatch), } } @@ -5956,14 +5974,14 @@ type V2Policy struct { // Constants associated with the V2Policy.Type property. // The policy type; either 'access' or 'authorization'. const ( - V2PolicyTypeAccessConst = "access" + V2PolicyTypeAccessConst = "access" V2PolicyTypeAuthorizationConst = "authorization" ) // Constants associated with the V2Policy.State property. // The policy state, either 'deleted' or 'active'. const ( - V2PolicyStateActiveConst = "active" + V2PolicyStateActiveConst = "active" V2PolicyStateDeletedConst = "deleted" ) @@ -6106,15 +6124,15 @@ type V2PolicyResourceAttribute struct { const ( V2PolicyResourceAttributeOperatorStringequalsConst = "stringEquals" V2PolicyResourceAttributeOperatorStringexistsConst = "stringExists" - V2PolicyResourceAttributeOperatorStringmatchConst = "stringMatch" + V2PolicyResourceAttributeOperatorStringmatchConst = "stringMatch" ) // NewV2PolicyResourceAttribute : Instantiate V2PolicyResourceAttribute (Generic Model Constructor) func (*IamPolicyManagementV1) NewV2PolicyResourceAttribute(key string, operator string, value interface{}) (_model *V2PolicyResourceAttribute, err error) { _model = &V2PolicyResourceAttribute{ - Key: core.StringPtr(key), + Key: core.StringPtr(key), Operator: core.StringPtr(operator), - Value: value, + Value: value, } err = core.ValidateStruct(_model, "required parameters") return @@ -6155,14 +6173,14 @@ type V2PolicyResourceTag struct { // The operator of an access management tag. const ( V2PolicyResourceTagOperatorStringequalsConst = "stringEquals" - V2PolicyResourceTagOperatorStringmatchConst = "stringMatch" + V2PolicyResourceTagOperatorStringmatchConst = "stringMatch" ) // NewV2PolicyResourceTag : Instantiate V2PolicyResourceTag (Generic Model Constructor) func (*IamPolicyManagementV1) NewV2PolicyResourceTag(key string, value string, operator string) (_model *V2PolicyResourceTag, err error) { _model = &V2PolicyResourceTag{ - Key: core.StringPtr(key), - Value: core.StringPtr(value), + Key: core.StringPtr(key), + Value: core.StringPtr(value), Operator: core.StringPtr(operator), } err = core.ValidateStruct(_model, "required parameters") @@ -6205,23 +6223,24 @@ type V2PolicyRule struct { // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time // period. - Conditions []RuleWithNestedConditionsConditionsItemIntf `json:"conditions,omitempty"` + Conditions []NestedConditionIntf `json:"conditions,omitempty"` } // Constants associated with the V2PolicyRule.Operator property. // The operator of an attribute. const ( - V2PolicyRuleOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" + V2PolicyRuleOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" V2PolicyRuleOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" - V2PolicyRuleOperatorDatetimelessthanConst = "dateTimeLessThan" - V2PolicyRuleOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" - V2PolicyRuleOperatorDayofweekanyofConst = "dayOfWeekAnyOf" - V2PolicyRuleOperatorDayofweekequalsConst = "dayOfWeekEquals" - V2PolicyRuleOperatorTimegreaterthanConst = "timeGreaterThan" - V2PolicyRuleOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" - V2PolicyRuleOperatorTimelessthanConst = "timeLessThan" - V2PolicyRuleOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" + V2PolicyRuleOperatorDatetimelessthanConst = "dateTimeLessThan" + V2PolicyRuleOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" + V2PolicyRuleOperatorDayofweekanyofConst = "dayOfWeekAnyOf" + V2PolicyRuleOperatorDayofweekequalsConst = "dayOfWeekEquals" + V2PolicyRuleOperatorTimegreaterthanConst = "timeGreaterThan" + V2PolicyRuleOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" + V2PolicyRuleOperatorTimelessthanConst = "timeLessThan" + V2PolicyRuleOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" ) + func (*V2PolicyRule) isaV2PolicyRule() bool { return true } @@ -6245,7 +6264,7 @@ func UnmarshalV2PolicyRule(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } - err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleWithNestedConditionsConditionsItem) + err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalNestedCondition) if err != nil { return } @@ -6300,9 +6319,9 @@ const ( // NewV2PolicySubjectAttribute : Instantiate V2PolicySubjectAttribute (Generic Model Constructor) func (*IamPolicyManagementV1) NewV2PolicySubjectAttribute(key string, operator string, value string) (_model *V2PolicySubjectAttribute, err error) { _model = &V2PolicySubjectAttribute{ - Key: core.StringPtr(key), + Key: core.StringPtr(key), Operator: core.StringPtr(operator), - Value: core.StringPtr(value), + Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") return @@ -6386,14 +6405,14 @@ type V2PolicyTemplateMetaData struct { // Constants associated with the V2PolicyTemplateMetaData.Type property. // The policy type; either 'access' or 'authorization'. const ( - V2PolicyTemplateMetaDataTypeAccessConst = "access" + V2PolicyTemplateMetaDataTypeAccessConst = "access" V2PolicyTemplateMetaDataTypeAuthorizationConst = "authorization" ) // Constants associated with the V2PolicyTemplateMetaData.State property. // The policy state, either 'deleted' or 'active'. const ( - V2PolicyTemplateMetaDataStateActiveConst = "active" + V2PolicyTemplateMetaDataStateActiveConst = "active" V2PolicyTemplateMetaDataStateDeletedConst = "deleted" ) @@ -6516,9 +6535,9 @@ func UnmarshalControlResponseControlWithEnrichedRoles(m map[string]json.RawMessa return } -// RuleWithNestedConditionsConditionsItemRuleAttribute : Rule that specifies additional access granted (e.g., time-based condition). -// This model "extends" RuleWithNestedConditionsConditionsItem -type RuleWithNestedConditionsConditionsItemRuleAttribute struct { +// NestedConditionRuleAttribute : Rule that specifies additional access granted (e.g., time-based condition). +// This model "extends" NestedCondition +type NestedConditionRuleAttribute struct { // The name of an attribute. Key *string `json:"key" validate:"required"` @@ -6530,39 +6549,39 @@ type RuleWithNestedConditionsConditionsItemRuleAttribute struct { Value interface{} `json:"value" validate:"required"` } -// Constants associated with the RuleWithNestedConditionsConditionsItemRuleAttribute.Operator property. +// Constants associated with the NestedConditionRuleAttribute.Operator property. // The operator of an attribute. const ( - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimelessthanConst = "dateTimeLessThan" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDayofweekanyofConst = "dayOfWeekAnyOf" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorDayofweekequalsConst = "dayOfWeekEquals" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimegreaterthanConst = "timeGreaterThan" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimelessthanConst = "timeLessThan" - RuleWithNestedConditionsConditionsItemRuleAttributeOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" + NestedConditionRuleAttributeOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" + NestedConditionRuleAttributeOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" + NestedConditionRuleAttributeOperatorDatetimelessthanConst = "dateTimeLessThan" + NestedConditionRuleAttributeOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" + NestedConditionRuleAttributeOperatorDayofweekanyofConst = "dayOfWeekAnyOf" + NestedConditionRuleAttributeOperatorDayofweekequalsConst = "dayOfWeekEquals" + NestedConditionRuleAttributeOperatorTimegreaterthanConst = "timeGreaterThan" + NestedConditionRuleAttributeOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" + NestedConditionRuleAttributeOperatorTimelessthanConst = "timeLessThan" + NestedConditionRuleAttributeOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" ) -// NewRuleWithNestedConditionsConditionsItemRuleAttribute : Instantiate RuleWithNestedConditionsConditionsItemRuleAttribute (Generic Model Constructor) -func (*IamPolicyManagementV1) NewRuleWithNestedConditionsConditionsItemRuleAttribute(key string, operator string, value interface{}) (_model *RuleWithNestedConditionsConditionsItemRuleAttribute, err error) { - _model = &RuleWithNestedConditionsConditionsItemRuleAttribute{ - Key: core.StringPtr(key), +// NewNestedConditionRuleAttribute : Instantiate NestedConditionRuleAttribute (Generic Model Constructor) +func (*IamPolicyManagementV1) NewNestedConditionRuleAttribute(key string, operator string, value interface{}) (_model *NestedConditionRuleAttribute, err error) { + _model = &NestedConditionRuleAttribute{ + Key: core.StringPtr(key), Operator: core.StringPtr(operator), - Value: value, + Value: value, } err = core.ValidateStruct(_model, "required parameters") return } -func (*RuleWithNestedConditionsConditionsItemRuleAttribute) isaRuleWithNestedConditionsConditionsItem() bool { +func (*NestedConditionRuleAttribute) isaNestedCondition() bool { return true } -// UnmarshalRuleWithNestedConditionsConditionsItemRuleAttribute unmarshals an instance of RuleWithNestedConditionsConditionsItemRuleAttribute from the specified map of raw messages. -func UnmarshalRuleWithNestedConditionsConditionsItemRuleAttribute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RuleWithNestedConditionsConditionsItemRuleAttribute) +// UnmarshalNestedConditionRuleAttribute unmarshals an instance of NestedConditionRuleAttribute from the specified map of raw messages. +func UnmarshalNestedConditionRuleAttribute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NestedConditionRuleAttribute) err = core.UnmarshalPrimitive(m, "key", &obj.Key) if err != nil { return @@ -6579,9 +6598,9 @@ func UnmarshalRuleWithNestedConditionsConditionsItemRuleAttribute(m map[string]j return } -// RuleWithNestedConditionsConditionsItemRuleWithConditions : Rule that specifies additional access granted (e.g., time-based condition) accross multiple conditions. -// This model "extends" RuleWithNestedConditionsConditionsItem -type RuleWithNestedConditionsConditionsItemRuleWithConditions struct { +// NestedConditionRuleWithConditions : Rule that specifies additional access granted (e.g., time-based condition) accross multiple conditions. +// This model "extends" NestedCondition +type NestedConditionRuleWithConditions struct { // Operator to evaluate conditions. Operator *string `json:"operator" validate:"required"` @@ -6590,30 +6609,30 @@ type RuleWithNestedConditionsConditionsItemRuleWithConditions struct { Conditions []RuleAttribute `json:"conditions" validate:"required"` } -// Constants associated with the RuleWithNestedConditionsConditionsItemRuleWithConditions.Operator property. +// Constants associated with the NestedConditionRuleWithConditions.Operator property. // Operator to evaluate conditions. const ( - RuleWithNestedConditionsConditionsItemRuleWithConditionsOperatorAndConst = "and" - RuleWithNestedConditionsConditionsItemRuleWithConditionsOperatorOrConst = "or" + NestedConditionRuleWithConditionsOperatorAndConst = "and" + NestedConditionRuleWithConditionsOperatorOrConst = "or" ) -// NewRuleWithNestedConditionsConditionsItemRuleWithConditions : Instantiate RuleWithNestedConditionsConditionsItemRuleWithConditions (Generic Model Constructor) -func (*IamPolicyManagementV1) NewRuleWithNestedConditionsConditionsItemRuleWithConditions(operator string, conditions []RuleAttribute) (_model *RuleWithNestedConditionsConditionsItemRuleWithConditions, err error) { - _model = &RuleWithNestedConditionsConditionsItemRuleWithConditions{ - Operator: core.StringPtr(operator), +// NewNestedConditionRuleWithConditions : Instantiate NestedConditionRuleWithConditions (Generic Model Constructor) +func (*IamPolicyManagementV1) NewNestedConditionRuleWithConditions(operator string, conditions []RuleAttribute) (_model *NestedConditionRuleWithConditions, err error) { + _model = &NestedConditionRuleWithConditions{ + Operator: core.StringPtr(operator), Conditions: conditions, } err = core.ValidateStruct(_model, "required parameters") return } -func (*RuleWithNestedConditionsConditionsItemRuleWithConditions) isaRuleWithNestedConditionsConditionsItem() bool { +func (*NestedConditionRuleWithConditions) isaNestedCondition() bool { return true } -// UnmarshalRuleWithNestedConditionsConditionsItemRuleWithConditions unmarshals an instance of RuleWithNestedConditionsConditionsItemRuleWithConditions from the specified map of raw messages. -func UnmarshalRuleWithNestedConditionsConditionsItemRuleWithConditions(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RuleWithNestedConditionsConditionsItemRuleWithConditions) +// UnmarshalNestedConditionRuleWithConditions unmarshals an instance of NestedConditionRuleWithConditions from the specified map of raw messages. +func UnmarshalNestedConditionRuleWithConditions(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NestedConditionRuleWithConditions) err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) if err != nil { return @@ -6643,24 +6662,24 @@ type V2PolicyRuleRuleAttribute struct { // Constants associated with the V2PolicyRuleRuleAttribute.Operator property. // The operator of an attribute. const ( - V2PolicyRuleRuleAttributeOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" + V2PolicyRuleRuleAttributeOperatorDatetimegreaterthanConst = "dateTimeGreaterThan" V2PolicyRuleRuleAttributeOperatorDatetimegreaterthanorequalsConst = "dateTimeGreaterThanOrEquals" - V2PolicyRuleRuleAttributeOperatorDatetimelessthanConst = "dateTimeLessThan" - V2PolicyRuleRuleAttributeOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" - V2PolicyRuleRuleAttributeOperatorDayofweekanyofConst = "dayOfWeekAnyOf" - V2PolicyRuleRuleAttributeOperatorDayofweekequalsConst = "dayOfWeekEquals" - V2PolicyRuleRuleAttributeOperatorTimegreaterthanConst = "timeGreaterThan" - V2PolicyRuleRuleAttributeOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" - V2PolicyRuleRuleAttributeOperatorTimelessthanConst = "timeLessThan" - V2PolicyRuleRuleAttributeOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" + V2PolicyRuleRuleAttributeOperatorDatetimelessthanConst = "dateTimeLessThan" + V2PolicyRuleRuleAttributeOperatorDatetimelessthanorequalsConst = "dateTimeLessThanOrEquals" + V2PolicyRuleRuleAttributeOperatorDayofweekanyofConst = "dayOfWeekAnyOf" + V2PolicyRuleRuleAttributeOperatorDayofweekequalsConst = "dayOfWeekEquals" + V2PolicyRuleRuleAttributeOperatorTimegreaterthanConst = "timeGreaterThan" + V2PolicyRuleRuleAttributeOperatorTimegreaterthanorequalsConst = "timeGreaterThanOrEquals" + V2PolicyRuleRuleAttributeOperatorTimelessthanConst = "timeLessThan" + V2PolicyRuleRuleAttributeOperatorTimelessthanorequalsConst = "timeLessThanOrEquals" ) // NewV2PolicyRuleRuleAttribute : Instantiate V2PolicyRuleRuleAttribute (Generic Model Constructor) func (*IamPolicyManagementV1) NewV2PolicyRuleRuleAttribute(key string, operator string, value interface{}) (_model *V2PolicyRuleRuleAttribute, err error) { _model = &V2PolicyRuleRuleAttribute{ - Key: core.StringPtr(key), + Key: core.StringPtr(key), Operator: core.StringPtr(operator), - Value: value, + Value: value, } err = core.ValidateStruct(_model, "required parameters") return @@ -6697,20 +6716,20 @@ type V2PolicyRuleRuleWithNestedConditions struct { // List of conditions associated with a policy, e.g., time-based conditions that grant access over a certain time // period. - Conditions []RuleWithNestedConditionsConditionsItemIntf `json:"conditions" validate:"required"` + Conditions []NestedConditionIntf `json:"conditions" validate:"required"` } // Constants associated with the V2PolicyRuleRuleWithNestedConditions.Operator property. // Operator to evaluate conditions. const ( V2PolicyRuleRuleWithNestedConditionsOperatorAndConst = "and" - V2PolicyRuleRuleWithNestedConditionsOperatorOrConst = "or" + V2PolicyRuleRuleWithNestedConditionsOperatorOrConst = "or" ) // NewV2PolicyRuleRuleWithNestedConditions : Instantiate V2PolicyRuleRuleWithNestedConditions (Generic Model Constructor) -func (*IamPolicyManagementV1) NewV2PolicyRuleRuleWithNestedConditions(operator string, conditions []RuleWithNestedConditionsConditionsItemIntf) (_model *V2PolicyRuleRuleWithNestedConditions, err error) { +func (*IamPolicyManagementV1) NewV2PolicyRuleRuleWithNestedConditions(operator string, conditions []NestedConditionIntf) (_model *V2PolicyRuleRuleWithNestedConditions, err error) { _model = &V2PolicyRuleRuleWithNestedConditions{ - Operator: core.StringPtr(operator), + Operator: core.StringPtr(operator), Conditions: conditions, } err = core.ValidateStruct(_model, "required parameters") @@ -6728,7 +6747,7 @@ func UnmarshalV2PolicyRuleRuleWithNestedConditions(m map[string]json.RawMessage, if err != nil { return } - err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalRuleWithNestedConditionsConditionsItem) + err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalNestedCondition) if err != nil { return } diff --git a/iampolicymanagementv1/iam_policy_management_v1_examples_test.go b/iampolicymanagementv1/iam_policy_management_v1_examples_test.go index 6e8941c5..419ff7b4 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_examples_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_examples_test.go @@ -371,24 +371,24 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() { *accountIDResourceAttribute, *serviceNameResourceAttribute}, Tags: []iampolicymanagementv1.V2PolicyResourceTag{*policyResourceTag}, } - weeklyConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ + weeklyConditionAttribute := &iampolicymanagementv1.NestedCondition{ Key: core.StringPtr("{{environment.attributes.day_of_week}}"), Operator: core.StringPtr("dayOfWeekAnyOf"), Value: []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"}, } - startConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ + startConditionAttribute := &iampolicymanagementv1.NestedCondition{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeGreaterThanOrEquals"), Value: core.StringPtr("09:00:00+00:00"), } - endConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ + endConditionAttribute := &iampolicymanagementv1.NestedCondition{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeLessThanOrEquals"), Value: core.StringPtr("17:00:00+00:00"), } policyRule := &iampolicymanagementv1.V2PolicyRule{ Operator: core.StringPtr("and"), - Conditions: []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{ + Conditions: []iampolicymanagementv1.NestedConditionIntf{ weeklyConditionAttribute, startConditionAttribute, endConditionAttribute}, } @@ -481,24 +481,24 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() { v2PolicyControl, "access", ) - weeklyConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ + weeklyConditionAttribute := &iampolicymanagementv1.NestedCondition{ Key: core.StringPtr("{{environment.attributes.day_of_week}}"), Operator: core.StringPtr("dayOfWeekAnyOf"), Value: []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00"}, } - startConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ + startConditionAttribute := &iampolicymanagementv1.NestedCondition{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeGreaterThanOrEquals"), Value: core.StringPtr("09:00:00+00:00"), } - endConditionAttribute := &iampolicymanagementv1.RuleWithNestedConditionsConditionsItem{ + endConditionAttribute := &iampolicymanagementv1.NestedCondition{ Key: core.StringPtr("{{environment.attributes.current_time}}"), Operator: core.StringPtr("timeLessThanOrEquals"), Value: core.StringPtr("17:00:00+00:00"), } policyRule := &iampolicymanagementv1.V2PolicyRule{ Operator: core.StringPtr("and"), - Conditions: []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{ + Conditions: []iampolicymanagementv1.NestedConditionIntf{ weeklyConditionAttribute, startConditionAttribute, endConditionAttribute}, } options.SetRule(policyRule) diff --git a/iampolicymanagementv1/iam_policy_management_v1_integration_test.go b/iampolicymanagementv1/iam_policy_management_v1_integration_test.go index 8aa321eb..c52e98f7 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_integration_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_integration_test.go @@ -348,24 +348,24 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() { control.Grant = grant // Construct an instance of Policy Rule Attribute - weeklyConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) + weeklyConditionAttribute := new(iampolicymanagementv1.NestedCondition) weeklyConditionAttribute.Key = core.StringPtr("{{environment.attributes.day_of_week}}") weeklyConditionAttribute.Operator = core.StringPtr("dayOfWeekAnyOf") weeklyConditionAttribute.Value = []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"} - startConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) + startConditionAttribute := new(iampolicymanagementv1.NestedCondition) startConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") startConditionAttribute.Operator = core.StringPtr("timeGreaterThanOrEquals") startConditionAttribute.Value = core.StringPtr("09:00:00+00:00") - endConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) + endConditionAttribute := new(iampolicymanagementv1.NestedCondition) endConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") endConditionAttribute.Operator = core.StringPtr("timeLessThanOrEquals") endConditionAttribute.Value = core.StringPtr("17:00:00+00:00") policyRule := new(iampolicymanagementv1.V2PolicyRule) policyRule.Operator = core.StringPtr("and") - policyRule.Conditions = []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{weeklyConditionAttribute, startConditionAttribute, endConditionAttribute} + policyRule.Conditions = []iampolicymanagementv1.NestedConditionIntf{weeklyConditionAttribute, startConditionAttribute, endConditionAttribute} // Construct an instance of the CreateV2PolicyOptions model options := new(iampolicymanagementv1.CreateV2PolicyOptions) @@ -454,26 +454,24 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() { control.Grant = grant // Construct an instance of Policy Rule Attribute - weeklyConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) + weeklyConditionAttribute := new(iampolicymanagementv1.NestedCondition) weeklyConditionAttribute.Key = core.StringPtr("{{environment.attributes.day_of_week}}") weeklyConditionAttribute.Operator = core.StringPtr("dayOfWeekAnyOf") weeklyConditionAttribute.Value = []string{"1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"} - startConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) + startConditionAttribute := new(iampolicymanagementv1.NestedCondition) startConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") startConditionAttribute.Operator = core.StringPtr("timeGreaterThanOrEquals") startConditionAttribute.Value = core.StringPtr("09:00:00+00:00") - endConditionAttribute := new(iampolicymanagementv1.RuleWithNestedConditionsConditionsItem) + endConditionAttribute := new(iampolicymanagementv1.NestedCondition) endConditionAttribute.Key = core.StringPtr("{{environment.attributes.current_time}}") endConditionAttribute.Operator = core.StringPtr("timeLessThanOrEquals") endConditionAttribute.Value = core.StringPtr("17:00:00+00:00") policyRule := new(iampolicymanagementv1.V2PolicyRule) policyRule.Operator = core.StringPtr("and") - // ruleCondtions := make([]iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf, 0) - // ruleCondtions = append(ruleCondtions, endConditionAttribute) - policyRule.Conditions = []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{weeklyConditionAttribute, startConditionAttribute, endConditionAttribute} + policyRule.Conditions = []iampolicymanagementv1.NestedConditionIntf{weeklyConditionAttribute, startConditionAttribute, endConditionAttribute} // Construct an instance of the ReplaceV2PolicyOptions model options := new(iampolicymanagementv1.ReplaceV2PolicyOptions) diff --git a/iampolicymanagementv1/iam_policy_management_v1_test.go b/iampolicymanagementv1/iam_policy_management_v1_test.go index c2c3e46f..d54fbc39 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_test.go @@ -66,14 +66,13 @@ var _ = Describe(`IamPolicyManagementV1`, func() { Context(`Using external config, construct service client instances`, func() { // Map containing environment variables used in testing. var testEnvironment = map[string]string{ - "IAM_POLICY_MANAGEMENT_URL": "https://iampolicymanagementv1/api", + "IAM_POLICY_MANAGEMENT_URL": "https://iampolicymanagementv1/api", "IAM_POLICY_MANAGEMENT_AUTH_TYPE": "noauth", } It(`Create service client using external config successfully`, func() { SetTestEnvironment(testEnvironment) - iamPolicyManagementService, serviceErr := iampolicymanagementv1.NewIamPolicyManagementV1UsingExternalConfig(&iampolicymanagementv1.IamPolicyManagementV1Options{ - }) + iamPolicyManagementService, serviceErr := iampolicymanagementv1.NewIamPolicyManagementV1UsingExternalConfig(&iampolicymanagementv1.IamPolicyManagementV1Options{}) Expect(iamPolicyManagementService).ToNot(BeNil()) Expect(serviceErr).To(BeNil()) ClearTestEnvironment(testEnvironment) @@ -102,8 +101,7 @@ var _ = Describe(`IamPolicyManagementV1`, func() { }) It(`Create service client using external config and set url programatically successfully`, func() { SetTestEnvironment(testEnvironment) - iamPolicyManagementService, serviceErr := iampolicymanagementv1.NewIamPolicyManagementV1UsingExternalConfig(&iampolicymanagementv1.IamPolicyManagementV1Options{ - }) + iamPolicyManagementService, serviceErr := iampolicymanagementv1.NewIamPolicyManagementV1UsingExternalConfig(&iampolicymanagementv1.IamPolicyManagementV1Options{}) err := iamPolicyManagementService.SetServiceURL("https://testService/api") Expect(err).To(BeNil()) Expect(iamPolicyManagementService).ToNot(BeNil()) @@ -121,13 +119,12 @@ var _ = Describe(`IamPolicyManagementV1`, func() { Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { // Map containing environment variables used in testing. var testEnvironment = map[string]string{ - "IAM_POLICY_MANAGEMENT_URL": "https://iampolicymanagementv1/api", + "IAM_POLICY_MANAGEMENT_URL": "https://iampolicymanagementv1/api", "IAM_POLICY_MANAGEMENT_AUTH_TYPE": "someOtherAuth", } SetTestEnvironment(testEnvironment) - iamPolicyManagementService, serviceErr := iampolicymanagementv1.NewIamPolicyManagementV1UsingExternalConfig(&iampolicymanagementv1.IamPolicyManagementV1Options{ - }) + iamPolicyManagementService, serviceErr := iampolicymanagementv1.NewIamPolicyManagementV1UsingExternalConfig(&iampolicymanagementv1.IamPolicyManagementV1Options{}) It(`Instantiate service client with error`, func() { Expect(iamPolicyManagementService).To(BeNil()) @@ -138,7 +135,7 @@ var _ = Describe(`IamPolicyManagementV1`, func() { Context(`Using external config, construct service client instances with error: Invalid URL`, func() { // Map containing environment variables used in testing. var testEnvironment = map[string]string{ - "IAM_POLICY_MANAGEMENT_AUTH_TYPE": "NOAuth", + "IAM_POLICY_MANAGEMENT_AUTH_TYPE": "NOAuth", } SetTestEnvironment(testEnvironment) @@ -8599,18 +8596,18 @@ var _ = Describe(`IamPolicyManagementV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewRuleWithNestedConditionsConditionsItemRuleAttribute successfully`, func() { + It(`Invoke NewNestedConditionRuleAttribute successfully`, func() { key := "testString" operator := "timeLessThan" value := core.StringPtr("testString") - _model, err := iamPolicyManagementService.NewRuleWithNestedConditionsConditionsItemRuleAttribute(key, operator, value) + _model, err := iamPolicyManagementService.NewNestedConditionRuleAttribute(key, operator, value) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewRuleWithNestedConditionsConditionsItemRuleWithConditions successfully`, func() { + It(`Invoke NewNestedConditionRuleWithConditions successfully`, func() { operator := "and" conditions := []iampolicymanagementv1.RuleAttribute{} - _model, err := iamPolicyManagementService.NewRuleWithNestedConditionsConditionsItemRuleWithConditions(operator, conditions) + _model, err := iamPolicyManagementService.NewNestedConditionRuleWithConditions(operator, conditions) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) @@ -8624,7 +8621,7 @@ var _ = Describe(`IamPolicyManagementV1`, func() { }) It(`Invoke NewV2PolicyRuleRuleWithNestedConditions successfully`, func() { operator := "and" - conditions := []iampolicymanagementv1.RuleWithNestedConditionsConditionsItemIntf{} + conditions := []iampolicymanagementv1.NestedConditionIntf{} _model, err := iamPolicyManagementService.NewV2PolicyRuleRuleWithNestedConditions(operator, conditions) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil())