iampolicymanagementv1

package
v0.17.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 9 Imported by: 22

Documentation

Overview

Package iampolicymanagementv1 : Operations and models for the IamPolicyManagementV1 service

Index

Constants

View Source
const DefaultServiceName = "iam_policy_management"

DefaultServiceName is the default key used to find external configuration information.

View Source
const DefaultServiceURL = "https://iam.cloud.ibm.com"

DefaultServiceURL is the default URL to make service requests to.

Variables

This section is empty.

Functions

func GetServiceURLForRegion added in v0.17.2

func GetServiceURLForRegion(region string) (string, error)

GetServiceURLForRegion returns the service URL to be used for the specified region

func UnmarshalCustomRole

func UnmarshalCustomRole(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalCustomRole unmarshals an instance of CustomRole from the specified map of raw messages.

func UnmarshalPolicy

func UnmarshalPolicy(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalPolicy unmarshals an instance of Policy from the specified map of raw messages.

func UnmarshalPolicyList

func UnmarshalPolicyList(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalPolicyList unmarshals an instance of PolicyList from the specified map of raw messages.

func UnmarshalPolicyResource

func UnmarshalPolicyResource(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalPolicyResource unmarshals an instance of PolicyResource from the specified map of raw messages.

func UnmarshalPolicyRole

func UnmarshalPolicyRole(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalPolicyRole unmarshals an instance of PolicyRole from the specified map of raw messages.

func UnmarshalPolicySubject

func UnmarshalPolicySubject(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalPolicySubject unmarshals an instance of PolicySubject from the specified map of raw messages.

func UnmarshalResourceAttribute

func UnmarshalResourceAttribute(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalResourceAttribute unmarshals an instance of ResourceAttribute from the specified map of raw messages.

func UnmarshalRole

func UnmarshalRole(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalRole unmarshals an instance of Role from the specified map of raw messages.

func UnmarshalRoleList

func UnmarshalRoleList(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalRoleList unmarshals an instance of RoleList from the specified map of raw messages.

func UnmarshalSubjectAttribute

func UnmarshalSubjectAttribute(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalSubjectAttribute unmarshals an instance of SubjectAttribute from the specified map of raw messages.

Types

type CreatePolicyOptions

type CreatePolicyOptions struct {
	// The policy type; either 'access' or 'authorization'.
	Type *string `json:"type" validate:"required"`

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

	// A set of role cloud resource names (CRNs) granted by the policy.
	Roles []PolicyRole `json:"roles" validate:"required"`

	// 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"`

	// Allows users to set headers on API requests
	Headers map[string]string
}

CreatePolicyOptions : The CreatePolicy options.

func (*CreatePolicyOptions) SetAcceptLanguage

func (options *CreatePolicyOptions) SetAcceptLanguage(acceptLanguage string) *CreatePolicyOptions

SetAcceptLanguage : Allow user to set AcceptLanguage

func (*CreatePolicyOptions) SetDescription added in v0.17.2

func (options *CreatePolicyOptions) SetDescription(description string) *CreatePolicyOptions

SetDescription : Allow user to set Description

func (*CreatePolicyOptions) SetHeaders

func (options *CreatePolicyOptions) SetHeaders(param map[string]string) *CreatePolicyOptions

SetHeaders : Allow user to set Headers

func (*CreatePolicyOptions) SetResources

func (options *CreatePolicyOptions) SetResources(resources []PolicyResource) *CreatePolicyOptions

SetResources : Allow user to set Resources

func (*CreatePolicyOptions) SetRoles

func (options *CreatePolicyOptions) SetRoles(roles []PolicyRole) *CreatePolicyOptions

SetRoles : Allow user to set Roles

func (*CreatePolicyOptions) SetSubjects

func (options *CreatePolicyOptions) SetSubjects(subjects []PolicySubject) *CreatePolicyOptions

SetSubjects : Allow user to set Subjects

func (*CreatePolicyOptions) SetType

func (options *CreatePolicyOptions) SetType(typeVar string) *CreatePolicyOptions

SetType : Allow user to set Type

type CreateRoleOptions

type CreateRoleOptions struct {
	// The display name of the role that is shown in the console.
	DisplayName *string `json:"display_name" validate:"required"`

	// The actions of the role.
	Actions []string `json:"actions" validate:"required"`

	// The name of the role that is used in the CRN. Can only be alphanumeric and has to be capitalized.
	Name *string `json:"name" validate:"required"`

	// The account GUID.
	AccountID *string `json:"account_id" validate:"required"`

	// The service name.
	ServiceName *string `json:"service_name" validate:"required"`

	// The description of the role.
	Description *string `json:"description,omitempty"`

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

	// Allows users to set headers on API requests
	Headers map[string]string
}

CreateRoleOptions : The CreateRole options.

func (*CreateRoleOptions) SetAcceptLanguage

func (options *CreateRoleOptions) SetAcceptLanguage(acceptLanguage string) *CreateRoleOptions

SetAcceptLanguage : Allow user to set AcceptLanguage

func (*CreateRoleOptions) SetAccountID

func (options *CreateRoleOptions) SetAccountID(accountID string) *CreateRoleOptions

SetAccountID : Allow user to set AccountID

func (*CreateRoleOptions) SetActions

func (options *CreateRoleOptions) SetActions(actions []string) *CreateRoleOptions

SetActions : Allow user to set Actions

func (*CreateRoleOptions) SetDescription

func (options *CreateRoleOptions) SetDescription(description string) *CreateRoleOptions

SetDescription : Allow user to set Description

func (*CreateRoleOptions) SetDisplayName

func (options *CreateRoleOptions) SetDisplayName(displayName string) *CreateRoleOptions

SetDisplayName : Allow user to set DisplayName

func (*CreateRoleOptions) SetHeaders

func (options *CreateRoleOptions) SetHeaders(param map[string]string) *CreateRoleOptions

SetHeaders : Allow user to set Headers

func (*CreateRoleOptions) SetName

func (options *CreateRoleOptions) SetName(name string) *CreateRoleOptions

SetName : Allow user to set Name

func (*CreateRoleOptions) SetServiceName

func (options *CreateRoleOptions) SetServiceName(serviceName string) *CreateRoleOptions

SetServiceName : Allow user to set ServiceName

type CustomRole

type CustomRole struct {
	// The role ID.
	ID *string `json:"id,omitempty"`

	// The display name of the role that is shown in the console.
	DisplayName *string `json:"display_name,omitempty"`

	// The description of the role.
	Description *string `json:"description,omitempty"`

	// The actions of the role.
	Actions []string `json:"actions,omitempty"`

	// The role CRN.
	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"`

	// The account GUID.
	AccountID *string `json:"account_id,omitempty"`

	// The service name.
	ServiceName *string `json:"service_name,omitempty"`

	// The UTC timestamp when the role was created.
	CreatedAt *strfmt.DateTime `json:"created_at,omitempty"`

	// The iam ID of the entity that created the role.
	CreatedByID *string `json:"created_by_id,omitempty"`

	// The UTC timestamp when the role was last modified.
	LastModifiedAt *strfmt.DateTime `json:"last_modified_at,omitempty"`

	// The iam ID of the entity that last modified the policy.
	LastModifiedByID *string `json:"last_modified_by_id,omitempty"`

	// The href link back to the role.
	Href *string `json:"href,omitempty"`
}

CustomRole : An additional set of properties associated with a role.

type DeletePolicyOptions

type DeletePolicyOptions struct {
	// The policy ID.
	PolicyID *string `json:"policy_id" validate:"required,ne="`

	// Allows users to set headers on API requests
	Headers map[string]string
}

DeletePolicyOptions : The DeletePolicy options.

func (*DeletePolicyOptions) SetHeaders

func (options *DeletePolicyOptions) SetHeaders(param map[string]string) *DeletePolicyOptions

SetHeaders : Allow user to set Headers

func (*DeletePolicyOptions) SetPolicyID

func (options *DeletePolicyOptions) SetPolicyID(policyID string) *DeletePolicyOptions

SetPolicyID : Allow user to set PolicyID

type DeleteRoleOptions

type DeleteRoleOptions struct {
	// The role ID.
	RoleID *string `json:"role_id" validate:"required,ne="`

	// Allows users to set headers on API requests
	Headers map[string]string
}

DeleteRoleOptions : The DeleteRole options.

func (*DeleteRoleOptions) SetHeaders

func (options *DeleteRoleOptions) SetHeaders(param map[string]string) *DeleteRoleOptions

SetHeaders : Allow user to set Headers

func (*DeleteRoleOptions) SetRoleID

func (options *DeleteRoleOptions) SetRoleID(roleID string) *DeleteRoleOptions

SetRoleID : Allow user to set RoleID

type GetPolicyOptions

type GetPolicyOptions struct {
	// The policy ID.
	PolicyID *string `json:"policy_id" validate:"required,ne="`

	// Allows users to set headers on API requests
	Headers map[string]string
}

GetPolicyOptions : The GetPolicy options.

func (*GetPolicyOptions) SetHeaders

func (options *GetPolicyOptions) SetHeaders(param map[string]string) *GetPolicyOptions

SetHeaders : Allow user to set Headers

func (*GetPolicyOptions) SetPolicyID

func (options *GetPolicyOptions) SetPolicyID(policyID string) *GetPolicyOptions

SetPolicyID : Allow user to set PolicyID

type GetRoleOptions

type GetRoleOptions struct {
	// The role ID.
	RoleID *string `json:"role_id" validate:"required,ne="`

	// Allows users to set headers on API requests
	Headers map[string]string
}

GetRoleOptions : The GetRole options.

func (*GetRoleOptions) SetHeaders

func (options *GetRoleOptions) SetHeaders(param map[string]string) *GetRoleOptions

SetHeaders : Allow user to set Headers

func (*GetRoleOptions) SetRoleID

func (options *GetRoleOptions) SetRoleID(roleID string) *GetRoleOptions

SetRoleID : Allow user to set RoleID

type IamPolicyManagementV1

type IamPolicyManagementV1 struct {
	Service *core.BaseService
}

IamPolicyManagementV1 : IAM Policy Management API

Version: 1.0.1

func NewIamPolicyManagementV1

func NewIamPolicyManagementV1(options *IamPolicyManagementV1Options) (service *IamPolicyManagementV1, err error)

NewIamPolicyManagementV1 : constructs an instance of IamPolicyManagementV1 with passed in options.

func NewIamPolicyManagementV1UsingExternalConfig

func NewIamPolicyManagementV1UsingExternalConfig(options *IamPolicyManagementV1Options) (iamPolicyManagement *IamPolicyManagementV1, err error)

NewIamPolicyManagementV1UsingExternalConfig : constructs an instance of IamPolicyManagementV1 with passed in options and external configuration.

func (*IamPolicyManagementV1) Clone added in v0.17.2

func (iamPolicyManagement *IamPolicyManagementV1) Clone() *IamPolicyManagementV1

Clone makes a copy of "iamPolicyManagement" suitable for processing requests.

func (*IamPolicyManagementV1) CreatePolicy

func (iamPolicyManagement *IamPolicyManagementV1) CreatePolicy(createPolicyOptions *CreatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error)

CreatePolicy : Create a policy Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and **authorization**. A policy administrator might want to create an access policy which grants access to a user, service-id, or an access group. They might also want to create an authorization policy and setup access between services. ### Access To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. The roles must be a subset of a service's or the platform's supported roles. The resource attributes must be a subset of a service's or the platform's supported attributes. The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. ### Authorization Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify 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 The policy roles must be a subset of the

supported authorization roles supported by the target service. The user must also have the same level of access or greater to the target resource in order to grant the role. The resource attributes must be a subset of a service's or the platform's supported attributes. Both the policy subject and the policy resource must include the **`serviceName`** and **`accountId`** attributes.

func (*IamPolicyManagementV1) CreatePolicyWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) CreatePolicyWithContext(ctx context.Context, createPolicyOptions *CreatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error)

CreatePolicyWithContext is an alternate form of the CreatePolicy method which supports a Context parameter

func (*IamPolicyManagementV1) CreateRole

func (iamPolicyManagement *IamPolicyManagementV1) CreateRole(createRoleOptions *CreateRoleOptions) (result *CustomRole, response *core.DetailedResponse, err error)

CreateRole : Create a role Creates a custom role for a specific service within the account. An account owner or a user assigned the Administrator role on the Role management service can create a custom role. Any number of actions for a single service can be mapped to the new role, but there must be at least one service-defined action to successfully create the new role.

func (*IamPolicyManagementV1) CreateRoleWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) CreateRoleWithContext(ctx context.Context, createRoleOptions *CreateRoleOptions) (result *CustomRole, response *core.DetailedResponse, err error)

CreateRoleWithContext is an alternate form of the CreateRole method which supports a Context parameter

func (*IamPolicyManagementV1) DeletePolicy

func (iamPolicyManagement *IamPolicyManagementV1) DeletePolicy(deletePolicyOptions *DeletePolicyOptions) (response *core.DetailedResponse, err error)

DeletePolicy : Delete a policy by ID Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service ID. If the subject of the policy is a locked service-id, the request will fail.

func (*IamPolicyManagementV1) DeletePolicyWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) DeletePolicyWithContext(ctx context.Context, deletePolicyOptions *DeletePolicyOptions) (response *core.DetailedResponse, err error)

DeletePolicyWithContext is an alternate form of the DeletePolicy method which supports a Context parameter

func (*IamPolicyManagementV1) DeleteRole

func (iamPolicyManagement *IamPolicyManagementV1) DeleteRole(deleteRoleOptions *DeleteRoleOptions) (response *core.DetailedResponse, err error)

DeleteRole : Delete a role by ID Delete a role by providing a role ID.

func (*IamPolicyManagementV1) DeleteRoleWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) DeleteRoleWithContext(ctx context.Context, deleteRoleOptions *DeleteRoleOptions) (response *core.DetailedResponse, err error)

DeleteRoleWithContext is an alternate form of the DeleteRole method which supports a Context parameter

func (*IamPolicyManagementV1) DisableRetries added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) DisableRetries()

DisableRetries disables automatic retries for requests invoked for this service instance.

func (*IamPolicyManagementV1) EnableRetries added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration)

EnableRetries enables automatic retries for requests invoked for this service instance. If either parameter is specified as 0, then a default value is used instead.

func (*IamPolicyManagementV1) GetEnableGzipCompression added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) GetEnableGzipCompression() bool

GetEnableGzipCompression returns the service's EnableGzipCompression field

func (*IamPolicyManagementV1) GetPolicy

func (iamPolicyManagement *IamPolicyManagementV1) GetPolicy(getPolicyOptions *GetPolicyOptions) (result *Policy, response *core.DetailedResponse, err error)

GetPolicy : Retrieve a policy by ID Retrieve a policy by providing a policy ID.

func (*IamPolicyManagementV1) GetPolicyWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) GetPolicyWithContext(ctx context.Context, getPolicyOptions *GetPolicyOptions) (result *Policy, response *core.DetailedResponse, err error)

GetPolicyWithContext is an alternate form of the GetPolicy method which supports a Context parameter

func (*IamPolicyManagementV1) GetRole

func (iamPolicyManagement *IamPolicyManagementV1) GetRole(getRoleOptions *GetRoleOptions) (result *CustomRole, response *core.DetailedResponse, err error)

GetRole : Retrieve a role by ID Retrieve a role by providing a role ID.

func (*IamPolicyManagementV1) GetRoleWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) GetRoleWithContext(ctx context.Context, getRoleOptions *GetRoleOptions) (result *CustomRole, response *core.DetailedResponse, err error)

GetRoleWithContext is an alternate form of the GetRole method which supports a Context parameter

func (*IamPolicyManagementV1) GetServiceURL added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) GetServiceURL() string

GetServiceURL returns the service URL

func (*IamPolicyManagementV1) ListPolicies

func (iamPolicyManagement *IamPolicyManagementV1) ListPolicies(listPoliciesOptions *ListPoliciesOptions) (result *PolicyList, response *core.DetailedResponse, err error)

ListPolicies : Get policies by attributes Get policies and filter by attributes. While managing policies, you may want to retrieve policies in the account and filter by attribute values. This can be done through query parameters. Currently, we only support the following attributes: account_id, iam_id, access_group_id, type, and service_type. account_id is a required query parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policies an empty array is returned.

func (*IamPolicyManagementV1) ListPoliciesWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) ListPoliciesWithContext(ctx context.Context, listPoliciesOptions *ListPoliciesOptions) (result *PolicyList, response *core.DetailedResponse, err error)

ListPoliciesWithContext is an alternate form of the ListPolicies method which supports a Context parameter

func (*IamPolicyManagementV1) ListRoles

func (iamPolicyManagement *IamPolicyManagementV1) ListRoles(listRolesOptions *ListRolesOptions) (result *RoleList, response *core.DetailedResponse, err error)

ListRoles : Get roles by filters Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can be done through query parameters. Currently, we only support the following attributes: account_id, and service_name. Only roles that match the filter and that the caller has read access to are returned. If the caller does not have read access to any roles an empty array is returned.

func (*IamPolicyManagementV1) ListRolesWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) ListRolesWithContext(ctx context.Context, listRolesOptions *ListRolesOptions) (result *RoleList, response *core.DetailedResponse, err error)

ListRolesWithContext is an alternate form of the ListRoles method which supports a Context parameter

func (*IamPolicyManagementV1) NewCreatePolicyOptions

func (*IamPolicyManagementV1) NewCreatePolicyOptions(typeVar string, subjects []PolicySubject, roles []PolicyRole, resources []PolicyResource) *CreatePolicyOptions

NewCreatePolicyOptions : Instantiate CreatePolicyOptions

func (*IamPolicyManagementV1) NewCreateRoleOptions

func (*IamPolicyManagementV1) NewCreateRoleOptions(displayName string, actions []string, name string, accountID string, serviceName string) *CreateRoleOptions

NewCreateRoleOptions : Instantiate CreateRoleOptions

func (*IamPolicyManagementV1) NewDeletePolicyOptions

func (*IamPolicyManagementV1) NewDeletePolicyOptions(policyID string) *DeletePolicyOptions

NewDeletePolicyOptions : Instantiate DeletePolicyOptions

func (*IamPolicyManagementV1) NewDeleteRoleOptions

func (*IamPolicyManagementV1) NewDeleteRoleOptions(roleID string) *DeleteRoleOptions

NewDeleteRoleOptions : Instantiate DeleteRoleOptions

func (*IamPolicyManagementV1) NewGetPolicyOptions

func (*IamPolicyManagementV1) NewGetPolicyOptions(policyID string) *GetPolicyOptions

NewGetPolicyOptions : Instantiate GetPolicyOptions

func (*IamPolicyManagementV1) NewGetRoleOptions

func (*IamPolicyManagementV1) NewGetRoleOptions(roleID string) *GetRoleOptions

NewGetRoleOptions : Instantiate GetRoleOptions

func (*IamPolicyManagementV1) NewListPoliciesOptions

func (*IamPolicyManagementV1) NewListPoliciesOptions(accountID string) *ListPoliciesOptions

NewListPoliciesOptions : Instantiate ListPoliciesOptions

func (*IamPolicyManagementV1) NewListRolesOptions

func (*IamPolicyManagementV1) NewListRolesOptions() *ListRolesOptions

NewListRolesOptions : Instantiate ListRolesOptions

func (*IamPolicyManagementV1) NewPolicyRole

func (*IamPolicyManagementV1) NewPolicyRole(roleID string) (model *PolicyRole, err error)

NewPolicyRole : Instantiate PolicyRole (Generic Model Constructor)

func (*IamPolicyManagementV1) NewResourceAttribute

func (*IamPolicyManagementV1) NewResourceAttribute(name string, value string) (model *ResourceAttribute, err error)

NewResourceAttribute : Instantiate ResourceAttribute (Generic Model Constructor)

func (*IamPolicyManagementV1) NewSubjectAttribute

func (*IamPolicyManagementV1) NewSubjectAttribute(name string, value string) (model *SubjectAttribute, err error)

NewSubjectAttribute : Instantiate SubjectAttribute (Generic Model Constructor)

func (*IamPolicyManagementV1) NewUpdatePolicyOptions

func (*IamPolicyManagementV1) NewUpdatePolicyOptions(policyID string, ifMatch string, typeVar string, subjects []PolicySubject, roles []PolicyRole, resources []PolicyResource) *UpdatePolicyOptions

NewUpdatePolicyOptions : Instantiate UpdatePolicyOptions

func (*IamPolicyManagementV1) NewUpdateRoleOptions

func (*IamPolicyManagementV1) NewUpdateRoleOptions(roleID string, ifMatch string) *UpdateRoleOptions

NewUpdateRoleOptions : Instantiate UpdateRoleOptions

func (*IamPolicyManagementV1) SetDefaultHeaders added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) SetDefaultHeaders(headers http.Header)

SetDefaultHeaders sets HTTP headers to be sent in every request

func (*IamPolicyManagementV1) SetEnableGzipCompression added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) SetEnableGzipCompression(enableGzip bool)

SetEnableGzipCompression sets the service's EnableGzipCompression field

func (*IamPolicyManagementV1) SetServiceURL

func (iamPolicyManagement *IamPolicyManagementV1) SetServiceURL(url string) error

SetServiceURL sets the service URL

func (*IamPolicyManagementV1) UpdatePolicy

func (iamPolicyManagement *IamPolicyManagementV1) UpdatePolicy(updatePolicyOptions *UpdatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error)

UpdatePolicy : Update a policy Update a policy to grant access between a subject and a resource. A policy administrator might want to update an existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). ### Access To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. The roles must be a subset of a service's or the platform's supported roles. The resource attributes must be a subset of a service's or the platform's supported attributes. The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. ### Authorization 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 The policy roles must be a subset of the

supported authorization roles supported by the target service. The user must also have the same level of access or greater to the target resource in order to grant the role. The resource attributes must be a subset of a service's or the platform's supported attributes. Both the policy subject and the policy resource must include the **`serviceName`** and **`accountId`** attributes.

func (*IamPolicyManagementV1) UpdatePolicyWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) UpdatePolicyWithContext(ctx context.Context, updatePolicyOptions *UpdatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error)

UpdatePolicyWithContext is an alternate form of the UpdatePolicy method which supports a Context parameter

func (*IamPolicyManagementV1) UpdateRole

func (iamPolicyManagement *IamPolicyManagementV1) UpdateRole(updateRoleOptions *UpdateRoleOptions) (result *CustomRole, response *core.DetailedResponse, err error)

UpdateRole : Update a role Update a custom role. A role administrator might want to update an existing role by updating the display name, description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed.

func (*IamPolicyManagementV1) UpdateRoleWithContext added in v0.12.2

func (iamPolicyManagement *IamPolicyManagementV1) UpdateRoleWithContext(ctx context.Context, updateRoleOptions *UpdateRoleOptions) (result *CustomRole, response *core.DetailedResponse, err error)

UpdateRoleWithContext is an alternate form of the UpdateRole method which supports a Context parameter

type IamPolicyManagementV1Options

type IamPolicyManagementV1Options struct {
	ServiceName   string
	URL           string
	Authenticator core.Authenticator
}

IamPolicyManagementV1Options : Service options

type ListPoliciesOptions

type ListPoliciesOptions struct {
	// The account GUID in which the policies belong to.
	AccountID *string `json:"account_id" validate:"required"`

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

	// The IAM ID used to identify the subject.
	IamID *string `json:"iam_id,omitempty"`

	// The access group id.
	AccessGroupID *string `json:"access_group_id,omitempty"`

	// The type of policy (access or authorization).
	Type *string `json:"type,omitempty"`

	// 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
}

ListPoliciesOptions : The ListPolicies options.

func (*ListPoliciesOptions) SetAcceptLanguage

func (options *ListPoliciesOptions) SetAcceptLanguage(acceptLanguage string) *ListPoliciesOptions

SetAcceptLanguage : Allow user to set AcceptLanguage

func (*ListPoliciesOptions) SetAccessGroupID

func (options *ListPoliciesOptions) SetAccessGroupID(accessGroupID string) *ListPoliciesOptions

SetAccessGroupID : Allow user to set AccessGroupID

func (*ListPoliciesOptions) SetAccountID

func (options *ListPoliciesOptions) SetAccountID(accountID string) *ListPoliciesOptions

SetAccountID : Allow user to set AccountID

func (*ListPoliciesOptions) SetFormat added in v0.17.2

func (options *ListPoliciesOptions) SetFormat(format string) *ListPoliciesOptions

SetFormat : Allow user to set Format

func (*ListPoliciesOptions) SetHeaders

func (options *ListPoliciesOptions) SetHeaders(param map[string]string) *ListPoliciesOptions

SetHeaders : Allow user to set Headers

func (*ListPoliciesOptions) SetIamID

func (options *ListPoliciesOptions) SetIamID(iamID string) *ListPoliciesOptions

SetIamID : Allow user to set IamID

func (*ListPoliciesOptions) SetServiceType

func (options *ListPoliciesOptions) SetServiceType(serviceType string) *ListPoliciesOptions

SetServiceType : Allow user to set ServiceType

func (*ListPoliciesOptions) SetSort added in v0.17.2

func (options *ListPoliciesOptions) SetSort(sort string) *ListPoliciesOptions

SetSort : Allow user to set Sort

func (*ListPoliciesOptions) SetType

func (options *ListPoliciesOptions) SetType(typeVar string) *ListPoliciesOptions

SetType : Allow user to set Type

type ListRolesOptions

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

	// The account GUID in which the roles belong to.
	AccountID *string `json:"account_id,omitempty"`

	// The name of service.
	ServiceName *string `json:"service_name,omitempty"`

	// Allows users to set headers on API requests
	Headers map[string]string
}

ListRolesOptions : The ListRoles options.

func (*ListRolesOptions) SetAcceptLanguage

func (options *ListRolesOptions) SetAcceptLanguage(acceptLanguage string) *ListRolesOptions

SetAcceptLanguage : Allow user to set AcceptLanguage

func (*ListRolesOptions) SetAccountID

func (options *ListRolesOptions) SetAccountID(accountID string) *ListRolesOptions

SetAccountID : Allow user to set AccountID

func (*ListRolesOptions) SetHeaders

func (options *ListRolesOptions) SetHeaders(param map[string]string) *ListRolesOptions

SetHeaders : Allow user to set Headers

func (*ListRolesOptions) SetServiceName

func (options *ListRolesOptions) SetServiceName(serviceName string) *ListRolesOptions

SetServiceName : Allow user to set ServiceName

type Policy

type Policy struct {
	// The policy ID.
	ID *string `json:"id,omitempty"`

	// 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"`

	// A set of role cloud resource names (CRNs) granted by the policy.
	Roles []PolicyRole `json:"roles,omitempty"`

	// The resources associated with a policy.
	Resources []PolicyResource `json:"resources,omitempty"`

	// The href link back to the policy.
	Href *string `json:"href,omitempty"`

	// The UTC timestamp when the policy was created.
	CreatedAt *strfmt.DateTime `json:"created_at,omitempty"`

	// The iam ID of the entity that created the policy.
	CreatedByID *string `json:"created_by_id,omitempty"`

	// The UTC timestamp when the policy was last modified.
	LastModifiedAt *strfmt.DateTime `json:"last_modified_at,omitempty"`

	// The iam ID of the entity that last modified the policy.
	LastModifiedByID *string `json:"last_modified_by_id,omitempty"`
}

Policy : The core set of properties associated with a policy.

type PolicyList

type PolicyList struct {
	// List of policies.
	Policies []Policy `json:"policies,omitempty"`
}

PolicyList : A collection of policies.

type PolicyResource

type PolicyResource struct {
	// List of resource attributes.
	Attributes []ResourceAttribute `json:"attributes,omitempty"`
}

PolicyResource : The attributes of the resource. Note that only one resource is allowed in a policy.

type PolicyRole

type PolicyRole struct {
	// The role cloud resource name granted by the policy.
	RoleID *string `json:"role_id" validate:"required"`

	// The display name of the role.
	DisplayName *string `json:"display_name,omitempty"`

	// The description of the role.
	Description *string `json:"description,omitempty"`
}

PolicyRole : A role associated with a policy.

type PolicySubject

type PolicySubject struct {
	// List of subject attributes.
	Attributes []SubjectAttribute `json:"attributes,omitempty"`
}

PolicySubject : The subject attribute values that must match in order for this policy to apply in a permission decision.

type ResourceAttribute

type ResourceAttribute struct {
	// The name of an attribute.
	Name *string `json:"name" validate:"required"`

	// The value of an attribute.
	Value *string `json:"value" validate:"required"`

	// The operator of an attribute.
	Operator *string `json:"operator,omitempty"`
}

ResourceAttribute : An attribute associated with a resource.

type Role

type Role struct {
	// The display name of the role that is shown in the console.
	DisplayName *string `json:"display_name,omitempty"`

	// The description of the role.
	Description *string `json:"description,omitempty"`

	// The actions of the role.
	Actions []string `json:"actions,omitempty"`

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

Role : A role resource.

type RoleList

type RoleList struct {
	// List of custom roles.
	CustomRoles []CustomRole `json:"custom_roles,omitempty"`

	// List of service roles.
	ServiceRoles []Role `json:"service_roles,omitempty"`

	// List of system roles.
	SystemRoles []Role `json:"system_roles,omitempty"`
}

RoleList : A collection of roles returned by the 'list roles' operation.

type SubjectAttribute

type SubjectAttribute struct {
	// The name of an attribute.
	Name *string `json:"name" validate:"required"`

	// The value of an attribute.
	Value *string `json:"value" validate:"required"`
}

SubjectAttribute : An attribute associated with a subject.

type UpdatePolicyOptions

type UpdatePolicyOptions struct {
	// The policy ID.
	PolicyID *string `json:"policy_id" validate:"required,ne="`

	// The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be
	// retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header.
	IfMatch *string `json:"If-Match" validate:"required"`

	// The policy type; either 'access' or 'authorization'.
	Type *string `json:"type" validate:"required"`

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

	// A set of role cloud resource names (CRNs) granted by the policy.
	Roles []PolicyRole `json:"roles" validate:"required"`

	// 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
}

UpdatePolicyOptions : The UpdatePolicy options.

func (*UpdatePolicyOptions) SetDescription added in v0.17.2

func (options *UpdatePolicyOptions) SetDescription(description string) *UpdatePolicyOptions

SetDescription : Allow user to set Description

func (*UpdatePolicyOptions) SetHeaders

func (options *UpdatePolicyOptions) SetHeaders(param map[string]string) *UpdatePolicyOptions

SetHeaders : Allow user to set Headers

func (*UpdatePolicyOptions) SetIfMatch

func (options *UpdatePolicyOptions) SetIfMatch(ifMatch string) *UpdatePolicyOptions

SetIfMatch : Allow user to set IfMatch

func (*UpdatePolicyOptions) SetPolicyID

func (options *UpdatePolicyOptions) SetPolicyID(policyID string) *UpdatePolicyOptions

SetPolicyID : Allow user to set PolicyID

func (*UpdatePolicyOptions) SetResources

func (options *UpdatePolicyOptions) SetResources(resources []PolicyResource) *UpdatePolicyOptions

SetResources : Allow user to set Resources

func (*UpdatePolicyOptions) SetRoles

func (options *UpdatePolicyOptions) SetRoles(roles []PolicyRole) *UpdatePolicyOptions

SetRoles : Allow user to set Roles

func (*UpdatePolicyOptions) SetSubjects

func (options *UpdatePolicyOptions) SetSubjects(subjects []PolicySubject) *UpdatePolicyOptions

SetSubjects : Allow user to set Subjects

func (*UpdatePolicyOptions) SetType

func (options *UpdatePolicyOptions) SetType(typeVar string) *UpdatePolicyOptions

SetType : Allow user to set Type

type UpdateRoleOptions

type UpdateRoleOptions struct {
	// The role ID.
	RoleID *string `json:"role_id" validate:"required,ne="`

	// The revision number for updating a role and must match the ETag value of the existing role. The Etag can be
	// retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header.
	IfMatch *string `json:"If-Match" validate:"required"`

	// The display name of the role that is shown in the console.
	DisplayName *string `json:"display_name,omitempty"`

	// The description of the role.
	Description *string `json:"description,omitempty"`

	// The actions of the role.
	Actions []string `json:"actions,omitempty"`

	// Allows users to set headers on API requests
	Headers map[string]string
}

UpdateRoleOptions : The UpdateRole options.

func (*UpdateRoleOptions) SetActions

func (options *UpdateRoleOptions) SetActions(actions []string) *UpdateRoleOptions

SetActions : Allow user to set Actions

func (*UpdateRoleOptions) SetDescription

func (options *UpdateRoleOptions) SetDescription(description string) *UpdateRoleOptions

SetDescription : Allow user to set Description

func (*UpdateRoleOptions) SetDisplayName

func (options *UpdateRoleOptions) SetDisplayName(displayName string) *UpdateRoleOptions

SetDisplayName : Allow user to set DisplayName

func (*UpdateRoleOptions) SetHeaders

func (options *UpdateRoleOptions) SetHeaders(param map[string]string) *UpdateRoleOptions

SetHeaders : Allow user to set Headers

func (*UpdateRoleOptions) SetIfMatch

func (options *UpdateRoleOptions) SetIfMatch(ifMatch string) *UpdateRoleOptions

SetIfMatch : Allow user to set IfMatch

func (*UpdateRoleOptions) SetRoleID

func (options *UpdateRoleOptions) SetRoleID(roleID string) *UpdateRoleOptions

SetRoleID : Allow user to set RoleID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL