Skip to content

Commit

Permalink
fix(IAM Policy Management): re-gen service with latest API
Browse files Browse the repository at this point in the history
  • Loading branch information
padamstx committed Dec 11, 2020
1 parent 42cb0be commit cd74762
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 13 deletions.
80 changes: 75 additions & 5 deletions iampolicymanagementv1/iam_policy_management_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-8d569e8f-20201030-111043
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-d753183b-20201209-163011
*/


Expand Down Expand Up @@ -109,6 +109,21 @@ func NewIamPolicyManagementV1(options *IamPolicyManagementV1Options) (service *I
return
}

// GetServiceURLForRegion returns the service URL to be used for the specified region
func GetServiceURLForRegion(region string) (string, error) {
return "", fmt.Errorf("service does not support regional URLs")
}

// Clone makes a copy of "iamPolicyManagement" suitable for processing requests.
func (iamPolicyManagement *IamPolicyManagementV1) Clone() *IamPolicyManagementV1 {
if core.IsNil(iamPolicyManagement) {
return nil
}
clone := *iamPolicyManagement
clone.Service = iamPolicyManagement.Service.Clone()
return &clone
}

// SetServiceURL sets the service URL
func (iamPolicyManagement *IamPolicyManagementV1) SetServiceURL(url string) error {
return iamPolicyManagement.Service.SetServiceURL(url)
Expand Down Expand Up @@ -200,6 +215,12 @@ func (iamPolicyManagement *IamPolicyManagementV1) ListPoliciesWithContext(ctx co
if listPoliciesOptions.ServiceType != nil {
builder.AddQuery("service_type", fmt.Sprint(*listPoliciesOptions.ServiceType))
}
if listPoliciesOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listPoliciesOptions.Sort))
}
if listPoliciesOptions.Format != nil {
builder.AddQuery("format", fmt.Sprint(*listPoliciesOptions.Format))
}

request, err := builder.Build()
if err != nil {
Expand Down Expand Up @@ -291,6 +312,9 @@ func (iamPolicyManagement *IamPolicyManagementV1) CreatePolicyWithContext(ctx co
if createPolicyOptions.Resources != nil {
body["resources"] = createPolicyOptions.Resources
}
if createPolicyOptions.Description != nil {
body["description"] = createPolicyOptions.Description
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
return
Expand Down Expand Up @@ -387,6 +411,9 @@ func (iamPolicyManagement *IamPolicyManagementV1) UpdatePolicyWithContext(ctx co
if updatePolicyOptions.Resources != nil {
body["resources"] = updatePolicyOptions.Resources
}
if updatePolicyOptions.Description != nil {
body["description"] = updatePolicyOptions.Description
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
return
Expand Down Expand Up @@ -864,6 +891,9 @@ type CreatePolicyOptions struct {
// The resources associated with a policy.
Resources []PolicyResource `json:"resources" validate:"required"`

// Customer-defined description.
Description *string `json:"description,omitempty"`

// Translation language code.
AcceptLanguage *string `json:"Accept-Language,omitempty"`

Expand Down Expand Up @@ -905,6 +935,12 @@ func (options *CreatePolicyOptions) SetResources(resources []PolicyResource) *Cr
return options
}

// SetDescription : Allow user to set Description
func (options *CreatePolicyOptions) SetDescription(description string) *CreatePolicyOptions {
options.Description = core.StringPtr(description)
return options
}

// SetAcceptLanguage : Allow user to set AcceptLanguage
func (options *CreatePolicyOptions) SetAcceptLanguage(acceptLanguage string) *CreatePolicyOptions {
options.AcceptLanguage = core.StringPtr(acceptLanguage)
Expand Down Expand Up @@ -1135,6 +1171,12 @@ type ListPoliciesOptions struct {
// The type of service.
ServiceType *string `json:"service_type,omitempty"`

// Sort the results by any of the top level policy fields (id, created_at, created_by_id, last_modified_at, etc).
Sort *string `json:"sort,omitempty"`

// Include additional data per policy returned [include_last_permit, display].
Format *string `json:"format,omitempty"`

// Allows users to set headers on API requests
Headers map[string]string
}
Expand Down Expand Up @@ -1182,6 +1224,18 @@ func (options *ListPoliciesOptions) SetServiceType(serviceType string) *ListPoli
return options
}

// SetSort : Allow user to set Sort
func (options *ListPoliciesOptions) SetSort(sort string) *ListPoliciesOptions {
options.Sort = core.StringPtr(sort)
return options
}

// SetFormat : Allow user to set Format
func (options *ListPoliciesOptions) SetFormat(format string) *ListPoliciesOptions {
options.Format = core.StringPtr(format)
return options
}

// SetHeaders : Allow user to set Headers
func (options *ListPoliciesOptions) SetHeaders(param map[string]string) *ListPoliciesOptions {
options.Headers = param
Expand Down Expand Up @@ -1253,6 +1307,9 @@ type UpdatePolicyOptions struct {
// The resources associated with a policy.
Resources []PolicyResource `json:"resources" validate:"required"`

// Customer-defined description.
Description *string `json:"description,omitempty"`

// Allows users to set headers on API requests
Headers map[string]string
}
Expand Down Expand Up @@ -1305,6 +1362,12 @@ func (options *UpdatePolicyOptions) SetResources(resources []PolicyResource) *Up
return options
}

// SetDescription : Allow user to set Description
func (options *UpdatePolicyOptions) SetDescription(description string) *UpdatePolicyOptions {
options.Description = core.StringPtr(description)
return options
}

// SetHeaders : Allow user to set Headers
func (options *UpdatePolicyOptions) SetHeaders(param map[string]string) *UpdatePolicyOptions {
options.Headers = param
Expand Down Expand Up @@ -1392,7 +1455,7 @@ type CustomRole struct {
Actions []string `json:"actions,omitempty"`

// The role CRN.
Crn *string `json:"crn,omitempty"`
CRN *string `json:"crn,omitempty"`

// The name of the role that is used in the CRN. Can only be alphanumeric and has to be capitalized.
Name *string `json:"name,omitempty"`
Expand Down Expand Up @@ -1439,7 +1502,7 @@ func UnmarshalCustomRole(m map[string]json.RawMessage, result interface{}) (err
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.Crn)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
return
}
Expand Down Expand Up @@ -1487,6 +1550,9 @@ type Policy struct {
// The policy type; either 'access' or 'authorization'.
Type *string `json:"type,omitempty"`

// Customer-defined description.
Description *string `json:"description,omitempty"`

// The subjects associated with a policy.
Subjects []PolicySubject `json:"subjects,omitempty"`

Expand Down Expand Up @@ -1524,6 +1590,10 @@ func UnmarshalPolicy(m map[string]json.RawMessage, result interface{}) (err erro
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "description", &obj.Description)
if err != nil {
return
}
err = core.UnmarshalModel(m, "subjects", &obj.Subjects, UnmarshalPolicySubject)
if err != nil {
return
Expand Down Expand Up @@ -1709,7 +1779,7 @@ type Role struct {
Actions []string `json:"actions,omitempty"`

// The role CRN.
Crn *string `json:"crn,omitempty"`
CRN *string `json:"crn,omitempty"`
}


Expand All @@ -1728,7 +1798,7 @@ func UnmarshalRole(m map[string]json.RawMessage, result interface{}) (err error)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.Crn)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
return
}
Expand Down

0 comments on commit cd74762

Please sign in to comment.