Documentation
¶
Index ¶
- func ResolvePolicyID(role string) (uint64, error)
- type Driver
- func (d *Driver) AddRole() (schema.IAMResult, error)
- func (d *Driver) AddUser() (schema.IAMResult, error)
- func (d *Driver) AttachPolicy(ctx context.Context, userName string, policyID uint64) error
- func (d *Driver) CreateAccessKey(ctx context.Context, userName string) (schema.IAMCredential, string, error)
- func (d *Driver) DelRole() (schema.IAMResult, 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 string, policyID uint64) 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)
- func (d *Driver) SetClientOptions(opts ...api.Option)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolvePolicyID ¶ added in v0.3.1
ResolvePolicyID accepts a numeric string ("200001") or a friendly name ("AdministratorAccess") and returns the corresponding CAM policy ID. The friendly-name mapping is intentionally narrow — call sites that need a long-tail policy should pass the numeric ID directly.
Types ¶
type Driver ¶
type Driver struct {
Credential auth.Credential
UserName string
Password string
RoleName string
Uin string
// contains filtered or unexported fields
}
func (*Driver) AttachPolicy ¶ added in v0.3.1
AttachPolicy binds policyID to the named CAM user.
func (*Driver) CreateAccessKey ¶ added in v0.3.1
func (d *Driver) CreateAccessKey(ctx context.Context, userName string) (schema.IAMCredential, string, error)
CreateAccessKey mints a fresh CAM access key pair. Tencent returns the secret only on creation; capture it from the second return value.
func (*Driver) DeleteAccessKey ¶ added in v0.3.1
DeleteAccessKey revokes a CAM access key by ID for userName.
func (*Driver) DetachPolicy ¶ added in v0.3.1
DetachPolicy removes policyID from the named CAM user.
func (*Driver) ListAccessKeys ¶ added in v0.3.1
func (d *Driver) ListAccessKeys(ctx context.Context, userName string) ([]schema.IAMCredential, error)
ListAccessKeys returns the CAM access keys belonging to userName. Tencent CAM keys are owned by a Uin, so when userName is non-empty the driver resolves it via GetUser; an empty userName lists keys for the calling principal.
func (*Driver) ListRoleBindings ¶ added in v0.3.1
func (d *Driver) ListRoleBindings(ctx context.Context, userName string) ([]schema.RoleBinding, error)
ListRoleBindings returns the policies currently attached to the named CAM sub-user. Tencent CAM identifies users by numeric Uin internally, so the driver resolves the supplied name via GetUser before paginating policies.