static void Main1(string[] args) { // 华为云 const string ak = "{your ak string}"; const string sk = "{your sk string}"; const string endpoint = "{your endpoint string}"; const string domainId = "{your domainID string}"; var config = HttpConfig.GetDefaultConfig(); config.IgnoreSslVerification = true; var auth = new BasicCredentials(ak, sk, null, domainId); var iamDomainClient = IamClient.NewBuilder() .WithCredential(auth) .WithEndPoint(endpoint) .WithHttpConfig(config).Build(); // Credential管理 // 通过委托获取临时访问秘钥和securitytoken POST /v3.0/OS-CREDENTIAL/securitytokens CreateTemporaryAccessKeyByAgency(iamDomainClient); // 通过token来获取临时AK/SK和securitytoken POST /v3.0/OS-CREDENTIAL/securitytokens CreateTemporaryAccessKeyByToken(iamDomainClient); }
static void Main1(string[] args) { // 华为云 const string ak = "{your ak string}"; const string sk = "{your sk string}"; const string endpoint = "{your endpoint string}"; const string domainId = "{your domainID string}"; var config = HttpConfig.GetDefaultConfig(); config.IgnoreSslVerification = true; var auth = new BasicCredentials(ak, sk, null, domainId); var iamDomainClient = IamClient.NewBuilder() .WithCredential(auth) .WithEndPoint(endpoint) .WithHttpConfig(config).Build(); // 委托管理 // 查询指定条件下的委托列表 GET /v3.0/OS-AGENCY/agencies ListAgencies(iamDomainClient); // 查询委托详情 GET /v3.0/OS-AGENCY/agencies/{agency_id} ShowAgency(iamDomainClient); // 创建委托 POST /v3.0/OS-AGENCY/agencies CreateAgency(iamDomainClient); // 修改委托 PUT /v3.0/OS-AGENCY/agencies/{agency_id} UpdateAgency(iamDomainClient); // 删除委托 DELETE /v3.0/OS-AGENCY/agencies/{agency_id} DeleteAgency(iamDomainClient); // 查询全局服务中的委托权限 GET /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles ListDomainPermissionsForAgency(iamDomainClient); // 查询项目服务中的委托权限 GET /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles ListProjectPermissionsForAgency(iamDomainClient); // 为委托授予全局服务权限 PUT /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id} AssociateAgencyWithDomainPermission(iamDomainClient); // 为委托授予项目服务权限 PUT /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id} AssociateAgencyWithProjectPermission(iamDomainClient); // 查询委托是否拥有全局服务权限 HEAD /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id} CheckDomainPermissionForAgency(iamDomainClient); // 查询委托是否拥有项目服务权限 HEAD /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id} CheckProjectPermissionForAgency(iamDomainClient); // 移除委托的全局服务权限 DELETE /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id} RemoveDomainPermissionFromAgency(iamDomainClient); // 移除委托的项目服务权限 DELETE /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id} RemoveProjectPermissionFromAgency(iamDomainClient); }
static void Main1(string[] args) { // 华为云 const string ak = "{your ak string}"; const string sk = "{your sk string}"; const string endpoint = "{your endpoint string}"; const string domainId = "{your domainID string}"; var config = HttpConfig.GetDefaultConfig(); config.IgnoreSslVerification = true; var auth = new GlobalCredentials(ak, sk, domainId); var iamDomainClient = IamClient.NewBuilder() .WithCredential(auth) .WithEndPoint(endpoint) .WithHttpConfig(config).Build(); // 权限管理 // 查询权限列表 GET /v3/roles KeystoneListPermissions(iamDomainClient); // 查询权限详情 GET /v3/roles/{role_id} KeystoneShowPermission(iamDomainClient); // 查询全局服务中的用户组权限 GET /v3/domains/{domain_id}/groups/{group_id}/roles KeystoneListDomainPermissionsForGroup(iamDomainClient); // 查询项目服务中的用户组权限 GET /v3/projects/{project_id}/groups/{group_id}/roles KeystoneListProjectPermissionsForGroup(iamDomainClient); // 为用户组授予全局服务权限 PUT /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id} KeystoneAssociateGroupWithDomainPermission(iamDomainClient); // 为用户组授予项目服务权限 PUT /v3/projects/{project_id}/groups/{group_id}/roles/{role_id} KeystoneAssociateGroupWithProjectPermission(iamDomainClient); // 查询用户组是否拥有全局服务权限 HEAD /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id} KeystoneCheckDomainPermissionForGroup(iamDomainClient); // 查询用户组是否拥有项目服务权限 HEAD /v3/projects/{project_id}/groups/{group_id}/roles/{role_id} KeystoneCheckProjectPermissionForGroup(iamDomainClient); // 移除用户组的全局服务权限 DELETE /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id} KeystoneRemoveDomainPermissionFromGroup(iamDomainClient); // 移除用户组的项目服务权限 DELETE /v3/projects/{project_id}/groups/{group_id}/roles/{role_id} KeystoneRemoveProjectPermissionFromGroup(iamDomainClient); }
static void Main1(string[] args) { // 华为云 const string ak = "{your ak string}"; const string sk = "{your sk string}"; const string endpoint = "{your endpoint string}"; const string domainId = "{your domainID string}"; var config = HttpConfig.GetDefaultConfig(); config.IgnoreSslVerification = true; var auth = new BasicCredentials(ak, sk, null, domainId); var iamDomainClient = IamClient.NewBuilder() .WithCredential(auth) .WithEndPoint(endpoint) .WithHttpConfig(config).Build(); // 用户组管理 // 查询用户组列表 GET /v3/groups KeystoneListGroups(iamDomainClient); // 查询用户组详情 GET /v3/groups/{group_id} KeystoneShowGroup(iamDomainClient); // 创建用户组 POST /v3/groups KeystoneCreateGroup(iamDomainClient); // 更新用户组 PATCH /v3/groups/{group_id} KeystoneUpdateGroup(iamDomainClient); // 删除用户组 DELETE /v3/groups/{group_id} KeystoneDeleteGroup(iamDomainClient); // 查询IAM用户是否在用户组中 HEAD /v3/groups/{group_id}/users/{user_id} KeystoneCheckUserInGroup(iamDomainClient); // 添加IAM用户到用户组 PUT /v3/groups/{group_id}/users/{user_id} KeystoneAddUserToGroup(iamDomainClient); // 移除用户组中的IAM用户 DELETE /v3/groups/{group_id}/users/{user_id} KeystoneRemoveUserFromGroup(iamDomainClient); }
static void Main1(string[] args) { // 华为云 const string ak = "{your ak string}"; const string sk = "{your sk string}"; const string endpoint = "{your endpoint string}"; const string domainId = "{your domainID string}"; var config = HttpConfig.GetDefaultConfig(); config.IgnoreSslVerification = true; var auth = new GlobalCredentials(ak, sk, domainId); var iamDomainClient = IamClient.NewBuilder() .WithCredential(auth) .WithEndPoint(endpoint) .WithHttpConfig(config).Build(); // 用户管理 // 管理员查询IAM用户列表 GET /v3/users KeystoneListUsers(iamDomainClient); // 查询IAM用户详情 GET /v3/users/{user_id} KeystoneShowUser(iamDomainClient); // 查询IAM用户所属用户组 GET /v3/users/{user_id}/groups KeystoneListGroupsForUser(iamDomainClient); // 管理员查询用户组所包含的IAM用户 GET /v3/groups/{group_id}/users KeystoneListUsersForGroupByAdmin(iamDomainClient); // 管理员创建IAM用户 POST /v3/users KeystoneCreateUser(iamDomainClient); // 修改IAM用户密码 POST /v3/users/{user_id}/password KeystoneUpdateUserPassword(iamDomainClient); // 管理员修改IAM用户信息 PATCH /v3/users/{user_id} KeystoneUpdateUserByAdmin(iamDomainClient); // 管理员删除IAM用户 DELETE /v3/users/{user_id} KeystoneDeleteUser(iamDomainClient); }