Skip to content

Commit

Permalink
fix(IAM Policy Management): re-gen service after fixing the assignmen…
Browse files Browse the repository at this point in the history
…t response (#321)

Signed-off-by: Rajesh K Pirati <rajesh.pirati@ibm.com>
  • Loading branch information
Rajesh-Pirati committed Apr 24, 2024
1 parent b3ac189 commit 2e4a365
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
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

0 comments on commit 2e4a365

Please sign in to comment.