iam

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolvePolicyURN added in v0.3.1

func ResolvePolicyURN(role string) string

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) AddUser

func (d *Driver) AddUser() (schema.IAMResult, error)

func (*Driver) AttachPolicy added in v0.3.1

func (d *Driver) AttachPolicy(ctx context.Context, userName, policyURN, scope string) error

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) DelUser

func (d *Driver) DelUser() (schema.IAMResult, error)

func (*Driver) DeleteAccessKey added in v0.3.1

func (d *Driver) DeleteAccessKey(ctx context.Context, userName, accessKeyID string) error

DeleteAccessKey revokes the API key identified by accessKeyID for userName.

func (*Driver) DetachPolicy added in v0.3.1

func (d *Driver) DetachPolicy(ctx context.Context, userName, policyURN, scope string) error

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).

func (*Driver) ListUsers

func (d *Driver) ListUsers(ctx context.Context) ([]schema.User, error)

Jump to

Keyboard shortcuts

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