ram

package
v0.0.0-...-ab98a91 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 2 Imported by: 123

Documentation

Index

Constants

View Source
const (
	// RAMDefaultEndpoint is the default API endpoint of RAM services
	RAMDefaultEndpoint = "https://ram.aliyuncs.com"
	RAMAPIVersion      = "2015-05-01"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKey

type AccessKey struct {
	AccessKeyId     string
	AccessKeySecret string
	Status          State
	CreateDate      string
}

type AccessKeyListResponse

type AccessKeyListResponse struct {
	RamCommonResponse
	AccessKeys struct {
		AccessKey []AccessKey
	}
}

type AccessKeyResponse

type AccessKeyResponse struct {
	RamCommonResponse
	AccessKey AccessKey
}

type AccountAlias

type AccountAlias string

AccountAlias 类型:String 必须:是 描述:指定云账号的别名, 长度限制为3-63个字符 限制:^[a-z0-9](([a-z0-9]|-(?!-))*[a-z0-9])?$

type AccountAliasRequest

type AccountAliasRequest struct {
	AccountAlias string
}

type AccountAliasResponse

type AccountAliasResponse struct {
	RamCommonResponse
	AccountAlias string
}

TODO implement ram api about security

SetAccountAlias()
GetAccountAlias()
ClearAccountAlias()
SetPasswordPolicy()
GetPasswordPolicy()

type AssumeRolePolicyDocument

type AssumeRolePolicyDocument struct {
	Statement []AssumeRolePolicyItem
	Version   string
}

type AssumeRolePolicyItem

type AssumeRolePolicyItem struct {
	Action    string
	Effect    string
	Principal AssumeRolePolicyPrincpal
}

type AssumeRolePolicyPrincpal

type AssumeRolePolicyPrincpal struct {
	RAM []string
}

type AttachPolicyRequest

type AttachPolicyRequest struct {
	PolicyRequest
	UserName string
}

type AttachPolicyToGroupRequest

type AttachPolicyToGroupRequest struct {
	PolicyRequest
	GroupName string
}

type AttachPolicyToRoleRequest

type AttachPolicyToRoleRequest struct {
	PolicyRequest
	RoleName string
}

type Group

type Group struct {
	GroupName string
	Comments  string
}

type GroupListRequest

type GroupListRequest struct {
	Marker   string
	MaxItems int8
}

type GroupListResponse

type GroupListResponse struct {
	RamCommonResponse
	IsTruncated bool
	Marker      string
	Groups      struct {
		Group []Group
	}
}

type GroupQueryRequest

type GroupQueryRequest struct {
	GroupName string
}

type GroupRequest

type GroupRequest struct {
	Group
}

type GroupResponse

type GroupResponse struct {
	RamCommonResponse
	Group Group
}

type GroupUpdateRequest

type GroupUpdateRequest struct {
	GroupName    string
	NewGroupName string
	NewComments  string
}

type ListRoleResponse

type ListRoleResponse struct {
	RamCommonResponse
	Roles struct {
		Role []Role
	}
}

type ListUserRequest

type ListUserRequest struct {
	Marker   string
	MaxItems int8
}

type ListUserResponse

type ListUserResponse struct {
	RamCommonResponse
	IsTruncated bool
	Marker      string
	Users       struct {
		User []User
	}
}

type LoginProfile

type LoginProfile struct {
	UserName              string
	PasswordResetRequired bool
	MFABindRequired       bool
}

type MFABindRequest

type MFABindRequest struct {
	SerialNumber        string
	UserName            string
	AuthenticationCode1 string
	AuthenticationCode2 string
}

type MFADeleteRequest

type MFADeleteRequest struct {
	MFADevice
}

type MFADevice

type MFADevice struct {
	SerialNumber string
}

type MFAListResponse

type MFAListResponse struct {
	RamCommonResponse
	VirtualMFADevices struct {
		VirtualMFADevice []VirtualMFADevice
	}
}

type MFARequest

type MFARequest struct {
	VirtualMFADeviceName string
}

type MFAResponse

type MFAResponse struct {
	RamCommonResponse
	VirtualMFADevice VirtualMFADevice
}

type MFAUserResponse

type MFAUserResponse struct {
	RamCommonResponse
	MFADevice MFADevice
}

type PasswordPolicy

type PasswordPolicy struct {
	MinimumPasswordLength      int8
	RequireLowercaseCharacters bool
	RequireUppercaseCharacters bool
	RequireNumbers             bool
	RequireSymbols             bool
}

type PasswordPolicyRequest

type PasswordPolicyRequest struct {
	PasswordPolicy
}

type PasswordPolicyResponse

type PasswordPolicyResponse struct {
	RamCommonResponse
	PasswordPolicy
}

type Policy

type Policy struct {
	PolicyName      string
	PolicyType      string
	Description     string
	DefaultVersion  string
	CreateDate      string
	UpdateDate      string
	AttachmentCount int64
}

type PolicyDocument

type PolicyDocument struct {
	Statement []PolicyItem
	Version   string
}

type PolicyItem

type PolicyItem struct {
	Action   string
	Effect   string
	Resource string
}

type PolicyListEntitiesResponse

type PolicyListEntitiesResponse struct {
	RamCommonResponse
	Groups struct {
		Group []Group
	}
	Users struct {
		User []User
	}
	Roles struct {
		Role []Role
	}
}

type PolicyListResponse

type PolicyListResponse struct {
	RamCommonResponse
	Policies struct {
		Policy []Policy
	}
}

type PolicyQueryRequest

type PolicyQueryRequest struct {
	PolicyType Type
	Marker     string
	MaxItems   int8
}

type PolicyQueryResponse

type PolicyQueryResponse struct {
	RamCommonResponse
	IsTruncated bool
	Marker      string
	Policies    struct {
		Policy []Policy
	}
}

type PolicyRequest

type PolicyRequest struct {
	PolicyName     string
	PolicyType     Type
	Description    string
	PolicyDocument string
	SetAsDefault   string
	VersionId      string
}

type PolicyResponse

type PolicyResponse struct {
	RamCommonResponse
	Policy               Policy
	DefaultPolicyVersion PolicyVersion
}

type PolicyVersion

type PolicyVersion struct {
	VersionId        string
	IsDefaultVersion bool
	CreateDate       string
	PolicyDocument   string
}

type PolicyVersionResponse

type PolicyVersionResponse struct {
	RamCommonResponse
	IsDefaultVersion bool
	VersionId        string
	CreateDate       string
	PolicyDocument   string
}

type PolicyVersionResponseNew

type PolicyVersionResponseNew struct {
	RamCommonResponse
	PolicyVersion struct {
		IsDefaultVersion bool
		VersionId        string
		CreateDate       string
		PolicyDocument   string
	}
}

type PolicyVersionsResponse

type PolicyVersionsResponse struct {
	RamCommonResponse
	PolicyVersions struct {
		PolicyVersion []PolicyVersion
	}
}

type ProfileRequest

type ProfileRequest struct {
	UserName              string
	Password              string
	PasswordResetRequired bool
	MFABindRequired       bool
}

type ProfileResponse

type ProfileResponse struct {
	RamCommonResponse
	LoginProfile LoginProfile
}

type RamClient

type RamClient struct {
	common.Client
}

func (*RamClient) AddUserToGroup

func (client *RamClient) AddUserToGroup(req UserRelateGroupRequest) (RamCommonResponse, error)

func (*RamClient) AttachPolicyToGroup

func (client *RamClient) AttachPolicyToGroup(attachPolicyRequest AttachPolicyToGroupRequest) (RamCommonResponse, error)

Group related

func (*RamClient) AttachPolicyToRole

func (client *RamClient) AttachPolicyToRole(attachPolicyRequest AttachPolicyToRoleRequest) (RamCommonResponse, error)

Role related

func (*RamClient) AttachPolicyToUser

func (client *RamClient) AttachPolicyToUser(attachPolicyRequest AttachPolicyRequest) (RamCommonResponse, error)

func (*RamClient) BindMFADevice

func (client *RamClient) BindMFADevice(req MFABindRequest) (RamCommonResponse, error)

func (*RamClient) ClearAccountAlias

func (client *RamClient) ClearAccountAlias() (RamCommonResponse, error)

func (*RamClient) CreateAccessKey

func (client *RamClient) CreateAccessKey(userQuery UserQueryRequest) (AccessKeyResponse, error)

func (*RamClient) CreateGroup

func (client *RamClient) CreateGroup(req GroupRequest) (GroupResponse, error)

func (*RamClient) CreateLoginProfile

func (client *RamClient) CreateLoginProfile(req ProfileRequest) (ProfileResponse, error)

func (*RamClient) CreatePolicy

func (client *RamClient) CreatePolicy(policyReq PolicyRequest) (PolicyResponse, error)

func (*RamClient) CreatePolicyVersion

func (client *RamClient) CreatePolicyVersion(policyReq PolicyRequest) (PolicyVersionResponse, error)

func (*RamClient) CreateRole

func (client *RamClient) CreateRole(role RoleRequest) (RoleResponse, error)

func (*RamClient) CreateUser

func (client *RamClient) CreateUser(user UserRequest) (UserResponse, error)

func (*RamClient) CreateVirtualMFADevice

func (client *RamClient) CreateVirtualMFADevice(req MFARequest) (MFAResponse, error)

func (*RamClient) DeleteAccessKey

func (client *RamClient) DeleteAccessKey(accessKeyRequest UpdateAccessKeyRequest) (RamCommonResponse, error)

func (*RamClient) DeleteGroup

func (client *RamClient) DeleteGroup(req GroupQueryRequest) (RamCommonResponse, error)

func (*RamClient) DeleteLoginProfile

func (client *RamClient) DeleteLoginProfile(req UserQueryRequest) (RamCommonResponse, error)

func (*RamClient) DeletePolicy

func (client *RamClient) DeletePolicy(policyReq PolicyRequest) (RamCommonResponse, error)

func (*RamClient) DeletePolicyVersion

func (client *RamClient) DeletePolicyVersion(policyReq PolicyRequest) (RamCommonResponse, error)

func (*RamClient) DeleteRole

func (client *RamClient) DeleteRole(roleQuery RoleQueryRequest) (RamCommonResponse, error)

func (*RamClient) DeleteUser

func (client *RamClient) DeleteUser(userQuery UserQueryRequest) (RamCommonResponse, error)

func (*RamClient) DeleteVirtualMFADevice

func (client *RamClient) DeleteVirtualMFADevice(req MFADeleteRequest) (RamCommonResponse, error)

func (*RamClient) DetachPolicyFromGroup

func (client *RamClient) DetachPolicyFromGroup(attachPolicyRequest AttachPolicyToGroupRequest) (RamCommonResponse, error)

func (*RamClient) DetachPolicyFromRole

func (client *RamClient) DetachPolicyFromRole(attachPolicyRequest AttachPolicyToRoleRequest) (RamCommonResponse, error)

func (*RamClient) DetachPolicyFromUser

func (client *RamClient) DetachPolicyFromUser(attachPolicyRequest AttachPolicyRequest) (RamCommonResponse, error)

func (*RamClient) GetAccountAlias

func (client *RamClient) GetAccountAlias() (AccountAliasResponse, error)

func (*RamClient) GetGroup

func (client *RamClient) GetGroup(req GroupQueryRequest) (GroupResponse, error)

func (*RamClient) GetLoginProfile

func (client *RamClient) GetLoginProfile(req UserQueryRequest) (ProfileResponse, error)

func (*RamClient) GetPasswordPolicy

func (client *RamClient) GetPasswordPolicy() (PasswordPolicyResponse, error)

func (*RamClient) GetPolicy

func (client *RamClient) GetPolicy(policyReq PolicyRequest) (PolicyResponse, error)

func (*RamClient) GetPolicyVersion

func (client *RamClient) GetPolicyVersion(policyReq PolicyRequest) (PolicyVersionResponse, error)

func (*RamClient) GetPolicyVersionNew

func (client *RamClient) GetPolicyVersionNew(policyReq PolicyRequest) (PolicyVersionResponseNew, error)

func (*RamClient) GetRole

func (client *RamClient) GetRole(roleQuery RoleQueryRequest) (RoleResponse, error)

func (*RamClient) GetUser

func (client *RamClient) GetUser(userQuery UserQueryRequest) (UserResponse, error)

func (*RamClient) GetUserMFAInfo

func (client *RamClient) GetUserMFAInfo(req UserQueryRequest) (MFAUserResponse, error)

func (*RamClient) ListAccessKeys

func (client *RamClient) ListAccessKeys(userQuery UserQueryRequest) (AccessKeyListResponse, error)

func (*RamClient) ListEntitiesForPolicy

func (client *RamClient) ListEntitiesForPolicy(policyReq PolicyRequest) (PolicyListEntitiesResponse, error)

func (*RamClient) ListGroup

func (client *RamClient) ListGroup(req GroupListRequest) (GroupListResponse, error)

func (*RamClient) ListGroupsForUser

func (client *RamClient) ListGroupsForUser(req UserQueryRequest) (GroupListResponse, error)

func (*RamClient) ListPolicies

func (client *RamClient) ListPolicies(policyQuery PolicyQueryRequest) (PolicyQueryResponse, error)

func (*RamClient) ListPoliciesForGroup

func (client *RamClient) ListPoliciesForGroup(groupQuery GroupQueryRequest) (PolicyListResponse, error)

func (*RamClient) ListPoliciesForRole

func (client *RamClient) ListPoliciesForRole(roleQuery RoleQueryRequest) (PolicyListResponse, error)

func (*RamClient) ListPoliciesForUser

func (client *RamClient) ListPoliciesForUser(userQuery UserQueryRequest) (PolicyListResponse, error)

func (*RamClient) ListPolicyVersions

func (client *RamClient) ListPolicyVersions(policyReq PolicyRequest) (PolicyVersionResponse, error)

func (*RamClient) ListPolicyVersionsNew

func (client *RamClient) ListPolicyVersionsNew(policyReq PolicyRequest) (PolicyVersionsResponse, error)

func (*RamClient) ListRoles

func (client *RamClient) ListRoles() (ListRoleResponse, error)

func (*RamClient) ListUsers

func (client *RamClient) ListUsers(listParams ListUserRequest) (ListUserResponse, error)

func (*RamClient) ListUsersForGroup

func (client *RamClient) ListUsersForGroup(req GroupQueryRequest) (ListUserResponse, error)

func (*RamClient) ListVirtualMFADevices

func (client *RamClient) ListVirtualMFADevices() (MFAListResponse, error)

func (*RamClient) RemoveUserFromGroup

func (client *RamClient) RemoveUserFromGroup(req UserRelateGroupRequest) (RamCommonResponse, error)

func (*RamClient) SetAccountAlias

func (client *RamClient) SetAccountAlias(accountalias AccountAliasRequest) (RamCommonResponse, error)

func (*RamClient) SetDefaultPolicyVersion

func (client *RamClient) SetDefaultPolicyVersion(policyReq PolicyRequest) (RamCommonResponse, error)

func (*RamClient) SetPasswordPolicy

func (client *RamClient) SetPasswordPolicy(passwordPolicy PasswordPolicyRequest) (PasswordPolicyResponse, error)

func (*RamClient) UnbindMFADevice

func (client *RamClient) UnbindMFADevice(req UserQueryRequest) (MFAUserResponse, error)

func (*RamClient) UpdateAccessKey

func (client *RamClient) UpdateAccessKey(accessKeyRequest UpdateAccessKeyRequest) (RamCommonResponse, error)

func (*RamClient) UpdateGroup

func (client *RamClient) UpdateGroup(req GroupUpdateRequest) (GroupResponse, error)

func (*RamClient) UpdateLoginProfile

func (client *RamClient) UpdateLoginProfile(req ProfileRequest) (ProfileResponse, error)

func (*RamClient) UpdateRole

func (client *RamClient) UpdateRole(newRole UpdateRoleRequest) (RoleResponse, error)

func (*RamClient) UpdateUser

func (client *RamClient) UpdateUser(newUser UpdateUserRequest) (UserResponse, error)

type RamClientInterface

type RamClientInterface interface {
	//ram user
	CreateUser(user UserRequest) (UserResponse, error)
	GetUser(userQuery UserQueryRequest) (UserResponse, error)
	UpdateUser(newUser UpdateUserRequest) (UserResponse, error)
	DeleteUser(userQuery UserQueryRequest) (RamCommonResponse, error)
	ListUsers(listParams ListUserRequest) (ListUserResponse, error)

	//ram login profile
	CreateLoginProfile(req ProfileRequest) (ProfileResponse, error)
	GetLoginProfile(req UserQueryRequest) (ProfileResponse, error)
	DeleteLoginProfile(req UserQueryRequest) (RamCommonResponse, error)
	UpdateLoginProfile(req ProfileRequest) (ProfileResponse, error)

	//ram ak
	CreateAccessKey(userQuery UserQueryRequest) (AccessKeyResponse, error)
	UpdateAccessKey(accessKeyRequest UpdateAccessKeyRequest) (RamCommonResponse, error)
	DeleteAccessKey(accessKeyRequest UpdateAccessKeyRequest) (RamCommonResponse, error)
	ListAccessKeys(userQuery UserQueryRequest) (AccessKeyListResponse, error)

	//ram mfa
	CreateVirtualMFADevice(req MFARequest) (MFAResponse, error)
	ListVirtualMFADevices() (MFAListResponse, error)
	DeleteVirtualMFADevice(req MFADeleteRequest) (RamCommonResponse, error)
	BindMFADevice(req MFABindRequest) (RamCommonResponse, error)
	UnbindMFADevice(req UserQueryRequest) (MFAUserResponse, error)
	GetUserMFAInfo(req UserQueryRequest) (MFAUserResponse, error)

	//ram group
	CreateGroup(req GroupRequest) (GroupResponse, error)
	GetGroup(req GroupQueryRequest) (GroupResponse, error)
	UpdateGroup(req GroupUpdateRequest) (GroupResponse, error)
	ListGroup(req GroupListRequest) (GroupListResponse, error)
	DeleteGroup(req GroupQueryRequest) (RamCommonResponse, error)
	AddUserToGroup(req UserRelateGroupRequest) (RamCommonResponse, error)
	RemoveUserFromGroup(req UserRelateGroupRequest) (RamCommonResponse, error)
	ListGroupsForUser(req UserQueryRequest) (GroupListResponse, error)
	ListUsersForGroup(req GroupQueryRequest) (ListUserResponse, error)

	CreateRole(role RoleRequest) (RoleResponse, error)
	GetRole(roleQuery RoleQueryRequest) (RoleResponse, error)
	UpdateRole(newRole UpdateRoleRequest) (RoleResponse, error)
	ListRoles() (ListRoleResponse, error)
	DeleteRole(roleQuery RoleQueryRequest) (RamCommonResponse, error)

	//DONE policy
	CreatePolicy(policyReq PolicyRequest) (PolicyResponse, error)
	GetPolicy(policyReq PolicyRequest) (PolicyResponse, error)
	DeletePolicy(policyReq PolicyRequest) (RamCommonResponse, error)
	ListPolicies(policyQuery PolicyQueryRequest) (PolicyQueryResponse, error)
	ListPoliciesForUser(userQuery UserQueryRequest) (PolicyListResponse, error)

	//ram policy version
	CreatePolicyVersion(policyReq PolicyRequest) (PolicyVersionResponse, error)
	GetPolicyVersion(policyReq PolicyRequest) (PolicyVersionResponse, error)
	GetPolicyVersionNew(policyReq PolicyRequest) (PolicyVersionResponseNew, error)
	DeletePolicyVersion(policyReq PolicyRequest) (RamCommonResponse, error)
	ListPolicyVersions(policyReq PolicyRequest) (PolicyVersionResponse, error)
	ListPolicyVersionsNew(policyReq PolicyRequest) (PolicyVersionsResponse, error)
	AttachPolicyToUser(attachPolicyRequest AttachPolicyRequest) (RamCommonResponse, error)
	DetachPolicyFromUser(attachPolicyRequest AttachPolicyRequest) (RamCommonResponse, error)
	ListEntitiesForPolicy(policyReq PolicyRequest) (PolicyListEntitiesResponse, error)
	SetDefaultPolicyVersion(policyReq PolicyRequest) (RamCommonResponse, error)
	ListPoliciesForGroup(groupQuery GroupQueryRequest) (PolicyListResponse, error)
	AttachPolicyToGroup(attachPolicyRequest AttachPolicyToGroupRequest) (RamCommonResponse, error)
	DetachPolicyFromGroup(attachPolicyRequest AttachPolicyToGroupRequest) (RamCommonResponse, error)
	AttachPolicyToRole(attachPolicyRequest AttachPolicyToRoleRequest) (RamCommonResponse, error)
	DetachPolicyFromRole(attachPolicyRequest AttachPolicyToRoleRequest) (RamCommonResponse, error)
	ListPoliciesForRole(roleQuery RoleQueryRequest) (PolicyListResponse, error)

	//ram security
	SetAccountAlias(accountAlias AccountAliasRequest) (RamCommonResponse, error)
	GetAccountAlias() (AccountAliasResponse, error)
	ClearAccountAlias() (RamCommonResponse, error)
	SetPasswordPolicy(passwordPolicy PasswordPolicyRequest) (PasswordPolicyResponse, error)
	GetPasswordPolicy() (PasswordPolicyResponse, error)

	// Common Client Methods
	SetUserAgent(userAgent string)
}

func NewClient

func NewClient(accessKeyId string, accessKeySecret string) RamClientInterface

func NewClientWithEndpoint

func NewClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string) RamClientInterface

func NewClientWithEndpointAndSecurityToken

func NewClientWithEndpointAndSecurityToken(endpoint string, accessKeyId string, accessKeySecret string, securityToken string) RamClientInterface

func NewClientWithSecurityToken

func NewClientWithSecurityToken(accessKeyId string, accessKeySecret string, securityToken string) RamClientInterface

type RamCommonResponse

type RamCommonResponse struct {
	common.Response
}

type Role

type Role struct {
	RoleId                   string
	RoleName                 string
	Arn                      string
	Description              string
	AssumeRolePolicyDocument string
	CreateDate               string
	UpdateDate               string
}

type RoleQueryRequest

type RoleQueryRequest struct {
	RoleName string
}

type RoleRequest

type RoleRequest struct {
	RoleName                 string
	AssumeRolePolicyDocument string
	Description              string
}

type RoleResponse

type RoleResponse struct {
	RamCommonResponse
	Role Role
}

type State

type State string

CreateAccessKey() UpdateAccessKey() DeleteAccessKey() ListAccessKeys()

const (
	Active   State = "Active"
	Inactive State = "Inactive"
)

type Type

type Type string
const (
	Custom Type = "Custom"
	System Type = "System"
)

type UpdateAccessKeyRequest

type UpdateAccessKeyRequest struct {
	UserAccessKeyId string
	Status          State
	UserName        string
}

type UpdateRoleRequest

type UpdateRoleRequest struct {
	RoleName                    string
	NewAssumeRolePolicyDocument string
}

type UpdateUserRequest

type UpdateUserRequest struct {
	UserName       string
	NewUserName    string
	NewDisplayName string
	NewMobilePhone string
	NewEmail       string
	NewComments    string
}

type User

type User struct {
	UserId        string
	UserName      string
	DisplayName   string
	MobilePhone   string
	Email         string
	Comments      string
	CreateDate    string
	UpdateDate    string
	LastLoginDate string
}

type UserQueryRequest

type UserQueryRequest struct {
	UserName string
}

type UserRelateGroupRequest

type UserRelateGroupRequest struct {
	UserName  string
	GroupName string
}

type UserRequest

type UserRequest struct {
	User
}

type UserResponse

type UserResponse struct {
	RamCommonResponse
	User User
}

type VirtualMFADevice

type VirtualMFADevice struct {
	SerialNumber     string
	Base32StringSeed string
	QRCodePNG        string
	ActivateDate     string
	User             User
}

Jump to

Keyboard shortcuts

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