Documentation
¶
Index ¶
- func ResolvePolicyURN(role string) string
- type Driver
- func (d *Driver) AddUser() (schema.IAMResult, error)
- func (d *Driver) AttachPolicy(ctx context.Context, userName, policyURN, scope string) error
- func (d *Driver) CreateAccessKey(ctx context.Context, userName string) (schema.IAMCredential, string, error)
- func (d *Driver) DelUser() (schema.IAMResult, error)
- func (d *Driver) DeleteAccessKey(ctx context.Context, userName, accessKeyID string) error
- func (d *Driver) DetachPolicy(ctx context.Context, userName, policyURN, scope string) error
- func (d *Driver) ListAccessKeys(ctx context.Context, userName string) ([]schema.IAMCredential, error)
- func (d *Driver) ListRoleBindings(ctx context.Context, userName string) ([]schema.RoleBinding, error)
- func (d *Driver) ListUsers(ctx context.Context) ([]schema.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolvePolicyURN ¶ added in v0.3.1
ResolvePolicyURN expands a bare policy name ("AdministratorAccess") into the fully-qualified UCloud policy URN. Already-qualified URNs are returned as-is.
Types ¶
type Driver ¶
type Driver struct {
Credential ucloudauth.Credential
Client *api.Client
ProjectID string
UserName string
Password string
}
func (*Driver) AttachPolicy ¶ added in v0.3.1
AttachPolicy binds policyURN to userName. scope is "Specified" (project- scoped, requires Driver.ProjectID) or "Unspecified" (account-wide); empty defaults to "Unspecified".
func (*Driver) CreateAccessKey ¶ added in v0.3.1
func (d *Driver) CreateAccessKey(ctx context.Context, userName string) (schema.IAMCredential, string, error)
CreateAccessKey provisions a new API key for the given UCloud IAM user. The secret is returned exactly once at creation time.
func (*Driver) DeleteAccessKey ¶ added in v0.3.1
DeleteAccessKey revokes the API key identified by accessKeyID for userName.
func (*Driver) DetachPolicy ¶ added in v0.3.1
DetachPolicy removes policyURN from userName.
func (*Driver) ListAccessKeys ¶ added in v0.3.1
func (d *Driver) ListAccessKeys(ctx context.Context, userName string) ([]schema.IAMCredential, error)
ListAccessKeys enumerates the API keys belonging to a UCloud IAM sub user. The action name follows the same `ListXForUser` family used by UCloud's other IAM enumeration RPCs (`ListPoliciesForUser`); verify against the upstream SDK before relying on this in production.
func (*Driver) ListRoleBindings ¶ added in v0.3.1
func (d *Driver) ListRoleBindings(ctx context.Context, userName string) ([]schema.RoleBinding, error)
ListRoleBindings returns the policies attached to userName.
UCloud's IAM `ListPoliciesForUser` action surfaces policy URNs (e.g. `ucs:iam::ucs:policy/AdministratorAccess`) along with whether the binding is account-wide (`Unspecified`) or scoped to a project (`Specified` + ProjectID).