/// <summary>
        /// 图像标签
        /// </summary>
        public RunImageTaggingResponse RunImageTagging(RunImageTaggingRequest runImageTaggingRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1.0/image/tagging", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", runImageTaggingRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <RunImageTaggingResponse>(response));
        }
        /// <summary>
        /// 查询云硬盘类型列表
        /// </summary>
        public CinderListVolumeTypesResponse CinderListVolumeTypes(CinderListVolumeTypesRequest cinderListVolumeTypesRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/types", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, cinderListVolumeTypesRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <CinderListVolumeTypesResponse>(response));
        }
Пример #3
0
        /// <summary>
        /// 查询配额
        /// </summary>
        public ShowQuotasResponse ShowQuotas(ShowQuotasRequest showQuotasRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/V1.0/{project_id}/quotas", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, showQuotasRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ShowQuotasResponse>(response));
        }
        /// <summary>
        /// 通过标签查询云硬盘资源实例详情
        /// </summary>
        public ListVolumesByTagsResponse ListVolumesByTags(ListVolumesByTagsRequest listVolumesByTagsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/cloudvolumes/resource_instances/action", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", listVolumesByTagsRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <ListVolumesByTagsResponse>(response));
        }
Пример #5
0
        /// <summary>
        /// 批量查询监控数据
        /// </summary>
        public BatchListMetricDataResponse BatchListMetricData(BatchListMetricDataRequest batchListMetricDataRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/V1.0/{project_id}/batch-query-metric-data", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", batchListMetricDataRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <BatchListMetricDataResponse>(response));
        }
        /// <summary>
        /// 管理员创建IAM用户
        /// </summary>
        public KeystoneCreateUserResponse KeystoneCreateUser(KeystoneCreateUserRequest keystoneCreateUserRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v3/users", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", keystoneCreateUserRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <KeystoneCreateUserResponse>(response));
        }
        /// <summary>
        /// 创建子网
        /// </summary>
        public CreateSubnetResponse CreateSubnet(CreateSubnetRequest createSubnetRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1/{project_id}/subnets", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createSubnetRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <CreateSubnetResponse>(response));
        }
        /// <summary>
        /// 查询所有云硬盘详情
        /// </summary>
        public ListVolumesDetailsResponse ListVolumesDetails(ListVolumesDetailsRequest listVolumesDetailsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/cloudvolumes/detail", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listVolumesDetailsRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ListVolumesDetailsResponse>(response));
        }
Пример #9
0
        /// <summary>
        /// 按条件查询租户镜像标签列表
        /// </summary>
        public ListTagsResponse ListTags(ListTagsRequest listTagsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1/cloudimages/tags", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listTagsRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ListTagsResponse>(response));
        }
Пример #10
0
        /// <summary>
        /// 创建镜像元数据(OpenStack原生)
        /// </summary>
        public GlanceCreateImageMetadataResponse GlanceCreateImageMetadata(GlanceCreateImageMetadataRequest glanceCreateImageMetadataRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v2/images", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", glanceCreateImageMetadataRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <GlanceCreateImageMetadataResponse>(response));
        }
Пример #11
0
        /// <summary>
        /// 查询弹性伸缩组列表
        /// </summary>
        public ListScalingGroupsResponse ListScalingGroups(ListScalingGroupsRequest listScalingGroupsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/autoscaling-api/v1/{project_id}/scaling_group", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listScalingGroupsRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ListScalingGroupsResponse>(response));
        }
Пример #12
0
        /// <summary>
        /// 制作整机镜像
        /// </summary>
        public CreateWholeImageResponse CreateWholeImage(CreateWholeImageRequest createWholeImageRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1/cloudimages/wholeimages/action", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createWholeImageRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <CreateWholeImageResponse>(response));
        }
        /// <summary>
        /// 创建委托
        /// </summary>
        public CreateAgencyResponse CreateAgency(CreateAgencyRequest createAgencyRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v3.0/OS-AGENCY/agencies", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createAgencyRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <CreateAgencyResponse>(response));
        }
Пример #14
0
        /// <summary>
        /// 批量删除弹性伸缩配置
        /// </summary>
        public BatchDeleteScalingConfigsResponse BatchDeleteScalingConfigs(BatchDeleteScalingConfigsRequest batchDeleteScalingConfigsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/autoscaling-api/v1/{project_id}/scaling_configurations", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", batchDeleteScalingConfigsRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerializeNull <BatchDeleteScalingConfigsResponse>(response));
        }
        /// <summary>
        /// 通过token获取临时访问密钥和securitytoken
        /// </summary>
        public CreateTemporaryAccessKeyByTokenResponse CreateTemporaryAccessKeyByToken(CreateTemporaryAccessKeyByTokenRequest createTemporaryAccessKeyByTokenRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v3.0/OS-CREDENTIAL/securitytokens", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createTemporaryAccessKeyByTokenRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <CreateTemporaryAccessKeyByTokenResponse>(response));
        }
        /// <summary>
        /// 查询指定条件下的委托列表
        /// </summary>
        public ListAgenciesResponse ListAgencies(ListAgenciesRequest listAgenciesRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v3.0/OS-AGENCY/agencies", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listAgenciesRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ListAgenciesResponse>(response));
        }
        /// <summary>
        /// 管理员查询IAM用户列表
        /// </summary>
        public KeystoneListUsersResponse KeystoneListUsers(KeystoneListUsersRequest keystoneListUsersRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v3/users", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, keystoneListUsersRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <KeystoneListUsersResponse>(response));
        }
Пример #18
0
        /// <summary>
        /// 查询指标列表
        /// </summary>
        public ListMetricsResponse ListMetrics(ListMetricsRequest listMetricsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/V1.0/{project_id}/metrics", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listMetricsRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ListMetricsResponse>(response));
        }
Пример #19
0
        private SdkResponse <Object> CompanySealSign(SDKClient client, string contractId, string documentId1, string documentId2)
        {
            ContractSignCompanyRequest request = new ContractSignCompanyRequest();

            request.ContractId = contractId;

            //若公章未指定签署位置,需要在签署时指定签署位置
            //若制定了签署位置,优先使用签署位置中的位置进行签署

            /*
             * Stamper companyStamper = new Stamper();
             * companyStamper.Type = "COMPANY";
             * companyStamper.OffsetX = 0.2;
             * companyStamper.OffsetY = 0.3;
             * companyStamper.Page = 1;
             * companyStamper.DocumentId = documentId1;
             * companyStamper.SealId = "2490828768980361630";
             *
             * Stamper companyTimeStamp = new Stamper();
             * companyTimeStamp.Type = "TIMESTAMP";
             * companyTimeStamp.OffsetX = 0.4;
             * companyTimeStamp.OffsetY = 0.2;
             * companyTimeStamp.Page = 1;
             * companyTimeStamp.DocumentId = documentId1;
             * companyTimeStamp.SealId = "2490828768980361630";
             *
             * //骑缝章签署需要文档页数在一页以上
             * Stamper acrossPageStamper = new Stamper();
             * acrossPageStamper.Type = "ACROSS_PAGE";
             * acrossPageStamper.OffsetY = 0.2;
             * acrossPageStamper.DocumentId = documentId1;
             * acrossPageStamper.SealId = "2490828768980361630";
             *
             * request.AddStampers(companyStamper);
             * request.AddStampers(companyTimeStamp);
             * request.AddStampers(acrossPageStamper);
             */


            string response = null;

            try
            {
                response = client.Service(request);
            }
            catch (Exception e)
            {
                throw new Exception("公章签署请求服务器失败,失败原因:" + e.Message);
            }
            SdkResponse <Object> sdkResponse = HttpJsonConvert.DeserializeResponse <Object>(response);

            if (!sdkResponse.Code.Equals(0))
            {
                throw new Exception("公章签署失败,失败原因:" + sdkResponse.Message);
            }
            return(sdkResponse);
        }
Пример #20
0
        /// <summary>
        /// 增加或修改标签
        /// </summary>
        public CreateOrUpdateTagsResponse CreateOrUpdateTags(CreateOrUpdateTagsRequest createOrUpdateTagsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1/cloudimages/tags", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createOrUpdateTagsRequest);
            SdkResponse response = DoHttpRequest("PUT", request);

            return(JsonUtils.DeSerializeNull <CreateOrUpdateTagsResponse>(response));
        }
Пример #21
0
        /// <summary>
        /// 批量删除镜像成员
        /// </summary>
        public BatchDeleteMembersResponse BatchDeleteMembers(BatchDeleteMembersRequest batchDeleteMembersRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1/cloudimages/members", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", batchDeleteMembersRequest);
            SdkResponse response = DoHttpRequest("DELETE", request);

            return(JsonUtils.DeSerialize <BatchDeleteMembersResponse>(response));
        }
Пример #22
0
        /// <summary>
        /// 镜像文件快速导入
        /// </summary>
        public ImportImageQuickResponse ImportImageQuick(ImportImageQuickRequest importImageQuickRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v2/cloudimages/quickimport/action", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", importImageQuickRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <ImportImageQuickResponse>(response));
        }
        /// <summary>
        /// 查询安全组规则列表
        /// </summary>
        public ListSecurityGroupRulesResponse ListSecurityGroupRules(ListSecurityGroupRulesRequest listSecurityGroupRulesRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1/{project_id}/security-group-rules", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listSecurityGroupRulesRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ListSecurityGroupRulesResponse>(response));
        }
Пример #24
0
        /// <summary>
        /// 查询镜像配额
        /// </summary>
        public ShowImageQuotaResponse ShowImageQuota(ShowImageQuotaRequest showImageQuotaRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/v1/cloudimages/quota", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, showImageQuotaRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ShowImageQuotaResponse>(response));
        }
Пример #25
0
        /// <summary>
        /// 添加监控数据
        /// </summary>
        public CreateMetricDataResponse CreateMetricData(CreateMetricDataRequest createMetricDataRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string      urlPath  = HttpUtils.AddUrlPath("/V1.0/{project_id}/metric-data", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createMetricDataRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerializeNull <CreateMetricDataResponse>(response));
        }
Пример #26
0
        /// <summary>
        /// 删除数据库实例
        /// </summary>
        public DeleteInstanceResponse DeleteInstance(DeleteInstanceRequest deleteInstanceRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("instance_id", deleteInstanceRequest.InstanceId.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v3/{project_id}/instances/{instance_id}", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, deleteInstanceRequest);
            SdkResponse response = DoHttpRequest("DELETE", request);

            return(JsonUtils.DeSerialize <DeleteInstanceResponse>(response));
        }
Пример #27
0
        /// <summary>
        /// 批量删除指定实例的标签
        /// </summary>
        public BatchDeleteInstanceTagsResponse BatchDeleteInstanceTags(BatchDeleteInstanceTagsRequest batchDeleteInstanceTagsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("instance_id", batchDeleteInstanceTagsRequest.InstanceId.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v3/{project_id}/instances/{instance_id}/tags/action", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json", batchDeleteInstanceTagsRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerializeNull <BatchDeleteInstanceTagsResponse>(response));
        }
Пример #28
0
        /// <summary>
        /// 查询自动备份策略
        /// </summary>
        public ShowBackupPolicyResponse ShowBackupPolicy(ShowBackupPolicyRequest showBackupPolicyRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("instance_id", showBackupPolicyRequest.InstanceId.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v3/{project_id}/instances/{instance_id}/backups/policy", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, showBackupPolicyRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ShowBackupPolicyResponse>(response));
        }
Пример #29
0
        /// <summary>
        /// 重启实例的数据库服务
        /// </summary>
        public RestartInstanceResponse RestartInstance(RestartInstanceRequest restartInstanceRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("instance_id", restartInstanceRequest.InstanceId.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v3/{project_id}/instances/{instance_id}/restart", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json", restartInstanceRequest);
            SdkResponse response = DoHttpRequest("POST", request);

            return(JsonUtils.DeSerialize <RestartInstanceResponse>(response));
        }
Пример #30
0
        /// <summary>
        /// 查询指定实例的标签信息
        /// </summary>
        public ListInstanceTagsResponse ListInstanceTags(ListInstanceTagsRequest listInstanceTagsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("instance_id", listInstanceTagsRequest.InstanceId.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v3/{project_id}/instances/{instance_id}/tags", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listInstanceTagsRequest);
            SdkResponse response = DoHttpRequest("GET", request);

            return(JsonUtils.DeSerialize <ListInstanceTagsResponse>(response));
        }
Пример #31
0
        private void LoadSinaWeiboContentComplete(SdkRequestType requestType, SdkResponse response)
        {
            try
            {
                if (response.errCode == SdkErrCode.SUCCESS)
                {
                    WStatuses statuses = null;
                    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(WStatuses));
                    statuses = ser.ReadObject(response.stream) as WStatuses;
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        if (statuses.statuses != null)
                        {
                            foreach (WStatus status in statuses.statuses)
                            {
                                ItemViewModel model = SinaWeiboModelConverter.ConvertItemToCommon(status);
                                if (model != null)
                                {
                                    App.ViewModel.SinaWeiboItems.Add(model);
                                }
                            }
                        }
                        m_progressIndicatorHelper.PopTask();
                    }
                    );
                }
                // 失败
                else
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        // 21327 expired_token Token 过期
                        if (response.specificCode == "21327")
                        {
                            MessageBox.Show("新浪微博帐号已过期,请重新登陆", ">_<", MessageBoxButton.OK);
                            // 清掉保存的当前帐号信息
                            // 但是关注人信息还保留着
                            PreferenceHelper.RemoveSinaWeiboLoginAccountPreference();
                        }

                        m_progressIndicatorHelper.PopTask();
                    });
                }
            }
            catch (System.Exception ex)
            {
                UmengSDK.UmengAnalytics.reportError(ex);
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("新浪微博加载过程中发生未知错误", "悲剧了>_<", MessageBoxButton.OK);
                    m_progressIndicatorHelper.PopTask();
                });
            }
        }
Пример #32
0
 void weiboRequestCompleted(SdkRequestType requestType, SdkResponse response)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         txtInput.IsReadOnly = false;
         if (response.errCode == SdkErrCode.SUCCESS)
         {
             MessageBox.Show("发送成功");
         }
         else
         {
             MessageBox.Show("发送失败");
         }
     });
 }