policies

package
v0.5.20 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json;charset=utf8"},
}

Functions

This section is empty.

Types

type Condition

type Condition map[string]map[string][]string

type CreateOpts

type CreateOpts struct {
	// Display name of the custom policy
	DisplayName string `json:"display_name" required:"true"`
	// Display mode which can only be AX or XA
	// AX: Account level.
	// XA: Project level.
	Type string `json:"type" required:"true"`
	// Description of the custom policy
	Description string `json:"description" required:"true"`
	// DescriptionCn string `json:"description_cn"`
	// Content of custom policy.
	Policy CreatePolicy `json:"policy" required:"true"`
}

func (CreateOpts) ToPolicyCreateMap

func (opts CreateOpts) ToPolicyCreateMap() (map[string]interface{}, error)

func (CreateOpts) ToPolicyUpdateMap

func (opts CreateOpts) ToPolicyUpdateMap() (map[string]interface{}, error)

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToPolicyCreateMap() (map[string]interface{}, error)
}

type CreatePolicy

type CreatePolicy struct {
	// Policy version. When creating a custom policy, set this parameter to 1.1
	Version string `json:"Version" required:"true"`
	// Statement of the policy
	// A policy can contain a maximum of eight statements.
	Statement []CreateStatement `json:"Statement" required:"true"`
}

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

func (CreateResult) Extract

func (r CreateResult) Extract() (*Policy, error)

func (CreateResult) ExtractPolicies

func (r CreateResult) ExtractPolicies() (ListPolicy, error)

type CreateStatement

type CreateStatement struct {
	// Specific operation permission on a resource. A maximum of 100 actions are allowed.
	// The value format is `Service name:Resource type:Operation`, for example, `vpc:ports:create`
	// `Service name`: indicates the product name, such as ecs, evs, or vpc. Only lowercase letters are allowed.
	// Resource types and operations are not case-sensitive. You can use an asterisk (*) to represent all operations.
	Action []string `json:"Action" required:"true"`
	// Effect of the permission. The value can be `Allow` or `Deny`.
	// If both `Allow` and `Deny` statements are found in a policy,
	// the authentication starts from the `Deny` statements.
	Effect string `json:"Effect" required:"true"`
	// Conditions for the permission to take effect. A maximum of 10 conditions are allowed.
	// Conditions can't be used if `Resource` is selected using delegating agencies.
	Condition Condition `json:"Condition,omitempty"`
	// Cloud resource. The array can contain a maximum of 10 resource strings - []string,
	// and each string cannot exceed 128 characters.
	// Format: ::::. For example, `obs:::bucket:*`. Asterisks are allowed.
	// In the case of a custom policy for agencies, the type of this parameter is map[string][]string
	// and the value should be set to
	// "Resource": {"uri": ["/iam/agencies/07805acaba800fdd4fbdc00b8f888c7c"]}.
	Resource interface{} `json:"Resource,omitempty"`
}

type CustomPolicy

type CustomPolicy struct {
	Version   string      `json:"Version"`
	Statement []Statement `json:"Statement"`
}

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (r DeleteResult)

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

func Get

func Get(client *golangsdk.ServiceClient, id string) (r GetResult)

func (GetResult) Extract

func (r GetResult) Extract() (*Policy, error)

func (GetResult) ExtractPolicies

func (r GetResult) ExtractPolicies() (ListPolicy, error)
type Links struct {
	Self     string `json:"self"`
	Previous string `json:"previous"`
	Next     string `json:"next"`
}

type ListOpts

type ListOpts struct {
	DisplayName string
	Type        string
	ID          string
	Page        int `q:"page"`
	PerPage     int `q:"per_page"`
}

ListOpts Page&PerPage options currently don't have any effect

func (ListOpts) ToPolicyListQuery

func (opts ListOpts) ToPolicyListQuery() (string, error)

type ListPolicy

type ListPolicy struct {
	Links       Links    `json:"links"`
	Roles       []Policy `json:"roles"`
	TotalNumber int      `json:"total_number"`
}

func FilterRoles

func FilterRoles(roles ListPolicy, opts ListOpts) (ListPolicy, error)

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) (ListPolicy, error)

type ListResult

type ListResult struct {
	// contains filtered or unexported fields
}

func (ListResult) Extract

func (r ListResult) Extract() (*Policy, error)

func (ListResult) ExtractPolicies

func (r ListResult) ExtractPolicies() (ListPolicy, error)

type Policy

type Policy struct {
	DomainId    string       `json:"domain_id"`
	References  int          `json:"references,omitempty"`
	UpdatedTime string       `json:"updated_time,omitempty"`
	CreatedTime string       `json:"created_time,omitempty"`
	Catalog     string       `json:"catalog"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Links       RolesLinks   `json:"links"`
	ID          string       `json:"id"`
	DisplayName string       `json:"display_name"`
	Type        string       `json:"type"`
	Policy      CustomPolicy `json:"policy"`
}

type PolicyPage

type PolicyPage struct {
	pagination.LinkedPageBase
}
type RolesLinks struct {
	Self string `json:"self"`
}

type Statement

type Statement struct {
	Action    []string    `json:"Action"`
	Effect    string      `json:"Effect"`
	Condition Condition   `json:"Condition,omitempty"`
	Resource  interface{} `json:"Resource,omitempty"`
}

type UpdateResult

type UpdateResult struct {
	// contains filtered or unexported fields
}

func Update

func Update(c *golangsdk.ServiceClient, id string, opts CreateOpts) (r UpdateResult)

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Policy, error)

func (UpdateResult) ExtractPolicies

func (r UpdateResult) ExtractPolicies() (ListPolicy, error)

Jump to

Keyboard shortcuts

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