Пример #1
0
        static void Main1(string[] args)
        {
            const string ak = "{your ak string}";
            const string sk = "{your sk string}";
            //for example endpoint = "https://ecs.XXXXXX.myhuaweicloud.com"
            const string endpoint  = "{your endpoint string}";
            const string projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var ecsClient = EcsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            CreatePostPaidServers(ecsClient);
            ShowServer(ecsClient);
            ListServersDetails(ecsClient);
            UpdateServer(ecsClient);
            ResizePostPaidServer(ecsClient);
            DeleteServers(ecsClient);
            BatchStopServers(ecsClient);
            BatchStartServers(ecsClient);
            BatchRebootServers(ecsClient);
        }
Пример #2
0
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth = new BasicCredentials(ak, sk, projectId);

            var kmsClient = KmsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            CreateTag(kmsClient);
            DeleteTag(kmsClient);
            BatchCreateTags(kmsClient);
            BatchDeleteTags(kmsClient);
            GetKeyTag(kmsClient);
            GetProjectTags(kmsClient);
            GetResourceInstance(kmsClient);
        }
Пример #3
0
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var imsClient = ImsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            CreateImageByInstance(imsClient);
            CreateImageByFile(imsClient);
            ExportImage(imsClient);
            CreateDataImage(imsClient);
            CreateWholeImage(imsClient);
            ImportImageQuick(imsClient);
            ListImages(imsClient);
            UpdateImage(imsClient);

            GlanceShowImage(imsClient);
            GlanceUpdateImage(imsClient);
            GlanceDeleteImage(imsClient);
            GlanceCreateImageMetadata(imsClient);
        }
Пример #4
0
        static void Main1(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var evsClient = EvsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            ShowVolume(evsClient);
            CreateVolume(evsClient);
            ResizeVolume(evsClient);
            ListVolumesDetails(evsClient);
            UpdateVolume(evsClient);
            DeleteVolume(evsClient);
            CinderListVolumeTypes(evsClient);
            CinderExportToImage(evsClient);
            CinderListQuotas(evsClient);
            CinderListAvailabilityZones(evsClient);
        }
Пример #5
0
        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);
        }
Пример #6
0
        private static void MainDcs(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var dcsClient = DcsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            // lifecycle hook test
            // CreateDcsInstance(dcsClient);
            // listFlavors(dcsClient);
            // stopMigrationTask(dcsClient);
            // createMigrationTask(dcsClient);
            // stopMigrationTask(dcsClient);
            // deleteMigrationTask(dcsClient);
            // createReplication(dcsClient);
            // deleteReplication(dcsClient);
            listMigrationTask(dcsClient);
        }
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth = new BasicCredentials(ak, sk, projectId);

            var kmsClient = KmsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            CreateKey(kmsClient);
            DeleteKey(kmsClient);
            CancelKeyDeletion(kmsClient);
            EnableKey(kmsClient);
            DisableKey(kmsClient);
            EnableKey(kmsClient);
            UpdateKeyAlias(kmsClient);
            UpdateKeyDescription(kmsClient);
        }
        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);
        }
        private static void InstanceMgtMain(string[] args)
        {
            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth        = new BasicCredentials(ak, sk, projectId);
            var kafkaClient = KafkaClient.NewBuilder()
                              .WithCredential(auth)
                              .WithEndPoint(endpoint)
                              .WithHttpConfig(config).Build();

            resetPassword(kafkaClient);
        }
        private static void ConsumeGroupMain(string[] args)
        {
            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var dmsClient = DmsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            // CreateConsumerGroup(dmsClient);
            listConsumerGroups(dmsClient);
        }
        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);
        }
Пример #12
0
        private static void QueueMgtMain(string[] args)
        {
            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var dmsClient = DmsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            // listQueues(dmsClient);
            CreateQueue(dmsClient);
            //deleteQueue(dmsClient);
        }
        private static void LifeCycleMgtMain(string[] args)
        {
            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth           = new BasicCredentials(ak, sk, projectId);
            var rabbitmqClient = RabbitmqClient.NewBuilder()
                                 .WithCredential(auth)
                                 .WithEndPoint(endpoint)
                                 .WithHttpConfig(config).Build();

            // listInstance(rabbitmqClient);
            // createPostPaidInstance(rabbitmqClient);
            batchRestartOrDeleteInstances(rabbitmqClient);
        }
        private static void OtherInterfaceMain(string[] args)
        {
            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth           = new BasicCredentials(ak, sk, projectId);
            var rabbitmqClient = RabbitmqClient.NewBuilder()
                                 .WithCredential(auth)
                                 .WithEndPoint(endpoint)
                                 .WithHttpConfig(config).Build();

            // listAvailableZones(rabbitmqClient);
            // listProducts(rabbitmqClient);
            showMaintainWindows(rabbitmqClient);
        }
        private static void TopicMgtMain(string[] args)
        {
            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth        = new BasicCredentials(ak, sk, projectId);
            var kafkaClient = KafkaClient.NewBuilder()
                              .WithCredential(auth)
                              .WithEndPoint(endpoint)
                              .WithHttpConfig(config).Build();

            //listInstanceTopics(kafkaClient);
            //createInstanceTopic(kafkaClient);
            batchDeleteInstanceTopic(kafkaClient);
        }
Пример #16
0
        static void DdsMain(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var ddsClient = DdsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            // DatastoreVersions
            ListDatastoreVersion(ddsClient);

            // Flavors
            ListFlavor(ddsClient);

            // Instances
            CreateInstance(ddsClient);
            RestartInstance(ddsClient);
            ListInstance(ddsClient);
            EnlargeInstanceVolume(ddsClient);
            EnlargeShardingNode(ddsClient);
            ResizeInstance(ddsClient);
            DeleteInstance(ddsClient);

            // Backups
            CreateManualBackup(ddsClient);
            ListBackups(ddsClient);
            SetBackupPolicy(ddsClient);
            GetBackupPolicy(ddsClient);
            DeleteManualBackup(ddsClient);

            // Tags
            ListInstancesByTags(ddsClient);
            BatchCreateInstanceTags(ddsClient);
            ListInstanceTags(ddsClient);
            BatchDeleteInstanceTags(ddsClient);
            QueryProjectTags(ddsClient);
        }
Пример #17
0
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var imsClient = ImsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            ListOsVersions(imsClient);
        }
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth        = new BasicCredentials(ak, sk, projectId);
            var iotdaClient = IoTDAClient.NewBuilder()
                              .WithCredential(auth)
                              .WithEndPoint(endpoint)
                              .WithHttpConfig(config).Build();

            createAsyncCommand(iotdaClient);
            showAsyncDeviceCommand(iotdaClient);
        }
Пример #19
0
        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);
        }
Пример #20
0
        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);
        }
Пример #21
0
        private static void Main1(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth     = new BasicCredentials(ak, sk, projectId);
            var asClient = AsClient.NewBuilder()
                           .WithCredential(auth)
                           .WithEndPoint(endpoint)
                           .WithHttpConfig(config).Build();

            //scaling group test
            ListScalingActivityLogsV1(asClient);
        }
        static void Main1(string[] args)
        {
            const string ak = "{your ak string}";
            const string sk = "{your sk string}";
            //for example endpoint = "https://ecs.XXXXXX.myhuaweicloud.com"
            const string endpoint  = "{your endpoint string}";
            const string projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var ecsClient = EcsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            ListServerInterfaces(ecsClient);
        }
Пример #23
0
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth        = new BasicCredentials(ak, sk, projectId);
            var iotdaClient = IoTDAClient.NewBuilder()
                              .WithCredential(auth)
                              .WithEndPoint(endpoint)
                              .WithHttpConfig(config).Build();

            getResourcesByTags(iotdaClient);
            bindTagsToResource(iotdaClient);
            unbindTagsToResource(iotdaClient);
        }
Пример #24
0
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth = new BasicCredentials(ak, sk, projectId);

            var kmsClient = KmsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            GenRandom(kmsClient);
            CreateDataKeyWithoutPlaintext(kmsClient);
            EncryptDataKey(kmsClient);
        }
Пример #25
0
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var vpcClient = VpcClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            ListSecurityGroupRules(vpcClient);
            ShowSecurityGroupRule(vpcClient);
            CreateSecurityGroupRule(vpcClient);
            DeleteSecurityGroupRule(vpcClient);
        }
        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 projectId = "{your projectID string}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth        = new BasicCredentials(ak, sk, projectId);
            var iotdaClient = IoTDAClient.NewBuilder()
                              .WithCredential(auth)
                              .WithEndPoint(endpoint)
                              .WithHttpConfig(config).Build();

            findOneSubscription(iotdaClient);
            findSubscriptions(iotdaClient);
            createSubscription(iotdaClient);
            updateSubscription(iotdaClient);
            deleteOneSubscription(iotdaClient);
        }
        static void Main1(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;

            var auth      = new BasicCredentials(ak, sk, projectId);
            var cesClient = CesClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            ShowMetricData(cesClient);
            BatchListMetricData(cesClient);
            ShowEventData(cesClient);
            CreateMetricData(cesClient);
        }
Пример #28
0
        static void Main1(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth      = new BasicCredentials(ak, sk, projectId);
            var evsClient = EvsClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            BatchCreateVolumeTags(evsClient);
            BatchDeleteVolumeTags(evsClient);
            ListVolumeTags(evsClient);
            ShowVolumeTags(evsClient);
            ListVolumesByTags(evsClient);
        }
Пример #29
0
        private static void Main1(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;
            var auth     = new BasicCredentials(ak, sk, projectId);
            var asClient = AsClient.NewBuilder()
                           .WithCredential(auth)
                           .WithEndPoint(endpoint)
                           .WithHttpConfig(config).Build();

            // tags test
            ListScalingTagInfosByTenantId(asClient);
            ListScalingTagInfosByResourceId(asClient);
            OperateScalingTagInfo(asClient);
            ListResourceInstances(asClient);
        }
Пример #30
0
        static void Main(string[] args)
        {
            const string ak        = "{your ak string}";
            const string sk        = "{your sk string}";
            const string endpoint  = "{your endpoint}";
            const string projectId = "{your project id}";

            var config = HttpConfig.GetDefaultConfig();

            config.IgnoreSslVerification = true;

            var auth      = new BasicCredentials(ak, sk, projectId);
            var cesClient = CesClient.NewBuilder()
                            .WithCredential(auth)
                            .WithEndPoint(endpoint)
                            .WithHttpConfig(config).Build();

            ListAlarms(cesClient);
            ShowAlarmByID(cesClient);
            UpdateAlarmAction(cesClient);
            DeleteAlarm(cesClient);
            CreateAlarm(cesClient);
        }