Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(IAM Policy Management): re-gen service after fix the assignment response #321

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions iampolicymanagementv1/iam_policy_management_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -5914,8 +5914,8 @@ func UnmarshalPolicyAssignmentV1OptionsRootTemplate(m map[string]json.RawMessage

// PolicyAssignmentV1Resources : The policy assignment resources.
type PolicyAssignmentV1Resources struct {
// policy template details.
Target *AssignmentTemplateDetails `json:"target,omitempty"`
// assignment target account and type.
Target *AssignmentTargetDetails `json:"target,omitempty"`

// Set of properties for the assigned resource.
Policy *PolicyAssignmentResourcePolicy `json:"policy,omitempty"`
Expand All @@ -5924,7 +5924,7 @@ type PolicyAssignmentV1Resources struct {
// UnmarshalPolicyAssignmentV1Resources unmarshals an instance of PolicyAssignmentV1Resources from the specified map of raw messages.
func UnmarshalPolicyAssignmentV1Resources(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PolicyAssignmentV1Resources)
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalAssignmentTemplateDetails)
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalAssignmentTargetDetails)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {

It(`CreatePolicyAssignments request example`, func() {
fmt.Println("\nCreatePolicyTemplateAssignment() result:")
// begin-create_policy_assignment
// begin-create_policy_template_assignment
template := iampolicymanagementv1.AssignmentTemplateDetails{
ID: &examplePolicyTemplateID,
Version: &examplePolicyTemplateBaseVersion,
Expand Down Expand Up @@ -1020,7 +1020,7 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
fmt.Println(string(b))

var assignmentDetails = policyAssignment.Assignments[0]
// end-create_policy_assignment
// end-create_policy_template_assignment
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
examplePolicyAssignmentETag = response.GetHeaders().Get(exampleETagHeader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() {
assignmentRequesterId string = "IBMid-" + strconv.Itoa(rand.Intn(100000))
assignmentID string = "orchestrator-id"
testPolicyAssignmentETag string = ""
testTargetType string = "Account"
)

var shouldSkipTest = func() {
Expand Down Expand Up @@ -795,7 +796,7 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() {
Expect(response.StatusCode).To(Equal(200))
Expect(policyTemplateCollection).ToNot(BeNil())

Expect(policyTemplateCollection.PolicyTemplates[0].Policy.Type).To(Equal(core.StringPtr("access")))
Expect(policyTemplateCollection.PolicyTemplates[0].Policy.Type).ToNot(BeNil())
Expect(policyTemplateCollection.PolicyTemplates[0].AccountID).To(Equal(&testAccountID))
Expect(policyTemplateCollection.PolicyTemplates[0].State).To(Equal(core.StringPtr("active")))
})
Expand Down Expand Up @@ -1063,7 +1064,7 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() {
}

target := &iampolicymanagementv1.AssignmentTargetDetails{
Type: core.StringPtr("Account"),
Type: &testTargetType,
ID: &testTargetAccountID,
}

Expand All @@ -1086,6 +1087,10 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() {
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(*assignmentDetails.Resources[0].Policy.ResourceCreated.ID).ToNot(BeNil())
Expect(*assignmentDetails.Resources[0].Target.ID).ToNot(BeNil())
Expect(*assignmentDetails.Resources[0].Target.ID).To(Equal(testTargetAccountID))
Expect(*assignmentDetails.Resources[0].Target.Type).ToNot(BeNil())
Expect(*assignmentDetails.Resources[0].Target.Type).To(Equal(testTargetType))
testPolicyAssignmentETag = response.GetHeaders().Get(etagHeader)
testPolicyAssignmentId = *assignmentDetails.ID
})
Expand Down
Loading