Documentation ¶
Index ¶
- Constants
- type AccessPolicyListResponse
- type AccessPolicyRequest
- type AccessPolicyResponse
- type Attribute
- type AuthorizationPolicy
- type AuthorizationPolicyRepository
- type AuthorizationPolicySearchQuery
- type IAMPAPAPI
- type IAMPolicy
- type IAMService
- type Policy
- type Resource
- func (r *Resource) AccessGroupID() string
- func (r *Resource) AccountID() string
- func (r *Resource) CustomAttributes() []Attribute
- func (r *Resource) GetAttribute(name string) string
- func (r *Resource) OrganizationID() string
- func (r *Resource) Region() string
- func (r *Resource) Resource() string
- func (r *Resource) ResourceGroupID() string
- func (r *Resource) ResourceType() string
- func (r *Resource) ServiceInstance() string
- func (r *Resource) ServiceName() string
- func (r *Resource) ServiceType() string
- func (r *Resource) SetAccessGroupID(value string)
- func (r *Resource) SetAccountID(value string)
- func (r *Resource) SetAttribute(name string, value string)
- func (r *Resource) SetOrganizationID(value string)
- func (r *Resource) SetRegion(value string)
- func (r *Resource) SetResource(value string)
- func (r *Resource) SetResourceGroupID(value string)
- func (r *Resource) SetResourceType(value string)
- func (r *Resource) SetServiceInstance(value string)
- func (r *Resource) SetServiceName(value string)
- func (r *Resource) SetServiceType(value string)
- func (r *Resource) SetSpaceID(value string)
- func (r *Resource) SpaceID() string
- type Resources
- type Role
- type Roles
- type SearchParams
- type Subject
- func (s *Subject) AccessGroupID() string
- func (s *Subject) AccountID() string
- func (s *Subject) GetAttribute(name string) string
- func (s *Subject) IAMID() string
- func (s *Subject) ResourceType() string
- func (s *Subject) ServiceInstance() string
- func (s *Subject) ServiceName() string
- func (s *Subject) SetAccessGroupID(value string)
- func (s *Subject) SetAccountID(value string)
- func (s *Subject) SetAttribute(name string, value string)
- func (s *Subject) SetIAMID(value string)
- func (s *Subject) SetResourceType(value string)
- func (s *Subject) SetServiceInstance(value string)
- func (s *Subject) SetServiceName(value string)
- type V1PolicyRepository
Constants ¶
const ( AuthorizationPolicyType = "authorization" AccessPolicyType = "access" )
const ( AccessGroupIDAttribute = "accesGroupId" AccountIDAttribute = "accountId" OrganizationIDAttribute = "organizationId" SpaceIDAttribute = "spaceId" RegionAttribute = "region" ServiceTypeAttribute = "serviceType" ServiceNameAttribute = "serviceName" ServiceInstanceAttribute = "serviceInstance" ResourceTypeAttribute = "resourceType" ResourceAttribute = "resource" ResourceGroupIDAttribute = "resourceGroupId" )
const ErrCodeAPICreation = "APICreationError"
ErrCodeAPICreation ...
const IAM_ACCOUNT_ESCAPE = "a%2f"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessPolicyListResponse ¶
type AccessPolicyListResponse struct {
Policies []AccessPolicyResponse
}
type AccessPolicyRequest ¶
type AccessPolicyResponse ¶
type AuthorizationPolicy ¶
type AuthorizationPolicy struct { ID string `json:"id,omitempty"` Roles []models.PolicyRole `json:"roles"` Resources []models.PolicyResource `json:"resources"` Subjects []models.PolicyResource `json:"subjects"` Type string `json:"type,omitempty"` Version string `json:"-"` }
type AuthorizationPolicyRepository ¶
type AuthorizationPolicyRepository interface { List(accountID string, query *AuthorizationPolicySearchQuery) ([]AuthorizationPolicy, error) Get(accountID string, policyID string) (AuthorizationPolicy, error) Create(accountID string, policy AuthorizationPolicy) (AuthorizationPolicy, error) Update(accountID string, policyID string, policy AuthorizationPolicy, version string) (AuthorizationPolicy, error) Delete(accountID string, policyID string) error }
func NewAuthorizationPolicyRepository ¶
func NewAuthorizationPolicyRepository(c *client.Client) AuthorizationPolicyRepository
type IAMPAPAPI ¶
type IAMPAPAPI interface { IAMPolicy() IAMPolicy IAMService() IAMService AuthorizationPolicies() AuthorizationPolicyRepository V1Policy() V1PolicyRepository }
IAMPAPAPI is the IAMpapv2 client ...
type IAMPolicy ¶
type IAMPolicy interface { Create(scope, userId string, params AccessPolicyRequest) (AccessPolicyResponse, string, error) List(scope, userId string) (AccessPolicyListResponse, error) Delete(scope, userId, policyId string) error Get(scope, userId, policyId string) (AccessPolicyResponse, error) Update(scope, userId, policyId, etag string, params AccessPolicyRequest) (AccessPolicyResponse, string, error) }
type IAMService ¶
type Policy ¶
type Policy struct { ID string `json:"id,omitempty"` Type string `json:"type"` Subjects []Subject `json:"subjects"` Roles []Role `json:"roles"` Resources []Resource `json:"resources"` Href string `json:"href,omitempty"` CreatedAt string `json:"created_at,omitempty"` CreatedByID string `json:"created_by_id,omitempty"` LastModifiedAt string `json:"last_modified_at,omitempty"` LastModifiedByID string `json:"last_modified_by_id,omitempty"` Version string `json:"-"` }
Policy is the model of IAM PAP policy
type Resource ¶
type Resource struct {
Attributes []Attribute `json:"attributes"`
}
Resource is the object controlled by the policy
func (*Resource) AccessGroupID ¶
AccessGroupID returns access group ID attribute of policy resource if exists
func (*Resource) CustomAttributes ¶
CustomAttributes will return all attributes which are not system defined
func (*Resource) GetAttribute ¶
GetAttribute returns an attribute of policy resource
func (*Resource) OrganizationID ¶
OrganizationID returns organization ID attribute of policy resource if exists
func (*Resource) ResourceGroupID ¶
ResourceGroupID returns resource group ID attribute of policy resource if exists
func (*Resource) ResourceType ¶
ResourceType returns resource type attribute of policy resource if exists
func (*Resource) ServiceInstance ¶
ServiceInstance returns service instance attribute of policy resource if exists
func (*Resource) ServiceName ¶
ServiceName returns service name attribute of policy resource if exists
func (*Resource) ServiceType ¶
ServiceType returns service type attribute of policy resource if exists
func (*Resource) SetAccessGroupID ¶
SetAccessGroupID sets value of access group ID attribute of policy resource
func (*Resource) SetAccountID ¶
SetAccountID sets value of account ID attribute of policy resource
func (*Resource) SetAttribute ¶
SetAttribute sets value of an attribute of policy resource
func (*Resource) SetOrganizationID ¶
SetOrganizationID sets value of organization ID attribute of policy resource
func (*Resource) SetResource ¶
SetResource sets value of resource attribute of policy resource
func (*Resource) SetResourceGroupID ¶
SetResourceGroupID sets value of resource group ID attribute of policy resource
func (*Resource) SetResourceType ¶
SetResourceType sets value of resource type attribute of policy resource
func (*Resource) SetServiceInstance ¶
SetServiceInstance sets value of service instance attribute of policy resource
func (*Resource) SetServiceName ¶
SetServiceName sets value of service name attribute of policy resource
func (*Resource) SetServiceType ¶
SetServiceType sets value of service type attribute of policy resource
func (*Resource) SetSpaceID ¶
SetSpaceID sets value of space ID attribute of policy resource
type Resources ¶
type Resources struct { ServiceName string `json:"serviceName,omitempty"` ServiceInstance string `json:"serviceInstance,omitempty"` Region string `json:"region,omitempty"` ResourceType string `json:"resourceType,omitempty"` Resource string `json:"resource,omitempty"` SpaceId string `json:"spaceId,omitempty"` AccountId string `json:"accountId,omitempty"` OrganizationId string `json:"organizationId,omitempty"` }
type Role ¶
type Role struct { RoleID string `json:"role_id"` Name string `json:"display_name,omitempty"` Description string `json:"description,omitempty"` }
Role is the role model used by policy
func ConvertRoleModels ¶
func ConvertRoleModels(roles []models.PolicyRole) []Role
ConvertRoleModels will transform role models returned from "/v1/roles" to the model used by policy
type SearchParams ¶
type Subject ¶
type Subject struct {
Attributes []Attribute `json:"attributes"`
}
Subject is the target to which is assigned policy
func (*Subject) AccessGroupID ¶
AccessGroupID returns access group ID attribute of policy subject if exists
func (*Subject) GetAttribute ¶
GetAttribute returns an attribute of policy subject
func (*Subject) ResourceType ¶
ResourceType returns resource type of the policy subject if exists
func (*Subject) ServiceInstance ¶
ServiceInstance returns service instance attribute of policy subject if exists
func (*Subject) ServiceName ¶
ServiceName returns service name attribute of policy subject if exists
func (*Subject) SetAccessGroupID ¶
SetAccessGroupID sets value of access group ID attribute of policy subject
func (*Subject) SetAccountID ¶
SetAccountID sets value of account ID attribute of policy subject
func (*Subject) SetAttribute ¶
SetAttribute sets value of an attribute of policy subject
func (*Subject) SetResourceType ¶
SetResourceType sets value of resource type attribute of policy subject
func (*Subject) SetServiceInstance ¶
SetServiceInstance sets value of service instance attribute of policy subject
func (*Subject) SetServiceName ¶
SetServiceName sets value of service name attribute of policy subject
type V1PolicyRepository ¶
type V1PolicyRepository interface { List(params SearchParams) ([]Policy, error) Get(policyID string) (Policy, error) Create(policy Policy) (Policy, error) Update(policyID string, policy Policy, version string) (Policy, error) Delete(policyID string) error }
func NewV1PolicyRepository ¶
func NewV1PolicyRepository(c *client.Client) V1PolicyRepository