Exemple #1
0
        internal DescribeServicesResponse DescribeServices(DescribeServicesRequest request)
        {
            var marshaller   = new DescribeServicesRequestMarshaller();
            var unmarshaller = DescribeServicesResponseUnmarshaller.Instance;

            return(Invoke <DescribeServicesRequest, DescribeServicesResponse>(request, marshaller, unmarshaller));
        }
Exemple #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonPricingConfig config = new AmazonPricingConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonPricingClient client = new AmazonPricingClient(creds, config);

            DescribeServicesResponse resp = new DescribeServicesResponse();

            do
            {
                DescribeServicesRequest req = new DescribeServicesRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.DescribeServices(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Services)
                {
                    AddObject(obj);
                }

                foreach (var obj in resp.FormatVersion)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /// <summary>
        /// <para>Returns the current list of AWS services and a list of service categories that applies to each one. You then use service names and
        /// categories in your CreateCase requests. Each AWS service has its own set of categories.</para> <para>The service codes and category codes
        /// correspond to the values that are displayed in the <b>Service</b> and <b>Category</b> drop-down lists on the AWS Support Center <a href="https://aws.amazon.com/support/createCase">Open a new case</a> page. The values in those fields, however, do not necessarily match
        /// the service codes and categories returned by the <c>DescribeServices</c> request. Always use the service codes and categories obtained
        /// programmatically. This practice ensures that you always have the most recent set of service and category codes.</para>
        /// </summary>
        ///
        /// <param name="describeServicesRequest">Container for the necessary parameters to execute the DescribeServices service method on
        /// AmazonAWSSupport.</param>
        ///
        /// <returns>The response from the DescribeServices service method, as returned by AmazonAWSSupport.</returns>
        ///
        /// <exception cref="T:Amazon.AWSSupport.Model.InternalServerErrorException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        public Task <DescribeServicesResponse> DescribeServicesAsync(DescribeServicesRequest describeServicesRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DescribeServicesRequestMarshaller();
            var unmarshaller = DescribeServicesResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, DescribeServicesRequest, DescribeServicesResponse>(describeServicesRequest, marshaller, unmarshaller, signer, cancellationToken));
        }
Exemple #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeServices operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DescribeServices operation on AmazonPricingClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeServices
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
        public virtual IAsyncResult BeginDescribeServices(DescribeServicesRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = DescribeServicesRequestMarshaller.Instance;
            var unmarshaller = DescribeServicesResponseUnmarshaller.Instance;

            return(BeginInvoke <DescribeServicesRequest>(request, marshaller, unmarshaller,
                                                         callback, state));
        }
Exemple #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeServices operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DescribeServices operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/support-2013-04-15/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
        public Task <DescribeServicesResponse> DescribeServicesAsync(DescribeServicesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DescribeServicesRequestMarshaller();
            var unmarshaller = DescribeServicesResponseUnmarshaller.Instance;

            return(InvokeAsync <DescribeServicesRequest, DescribeServicesResponse>(request, marshaller,
                                                                                   unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeServices operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DescribeServices operation on AmazonPricingClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeServices
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
        public virtual IAsyncResult BeginDescribeServices(DescribeServicesRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DescribeServicesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DescribeServicesResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
        /// <summary>
        /// Returns the metadata for one service or a list of the metadata for all services. Use
        /// this without a service code to get the service codes for all services. Use it with
        /// a service code, such as <code>AmazonEC2</code>, to get information specific to that
        /// service, such as the attribute names available for that service. For example, some
        /// of the attribute names available for EC2 are <code>volumeType</code>, <code>maxIopsVolume</code>,
        /// <code>operation</code>, <code>locationType</code>, and <code>instanceCapacity10xlarge</code>.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DescribeServices service method.</param>
        ///
        /// <returns>The response from the DescribeServices service method, as returned by Pricing.</returns>
        /// <exception cref="Amazon.Pricing.Model.ExpiredNextTokenException">
        /// The pagination token expired. Try again without a pagination token.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.InternalErrorException">
        /// An error on the server occurred during the processing of your request. Try again later.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.InvalidNextTokenException">
        /// The pagination token is invalid. Try again without a pagination token.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.InvalidParameterException">
        /// One or more parameters had an invalid value.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.NotFoundException">
        /// The requested resource can't be found.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
        public virtual DescribeServicesResponse DescribeServices(DescribeServicesRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DescribeServicesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DescribeServicesResponseUnmarshaller.Instance;

            return(Invoke <DescribeServicesResponse>(request, options));
        }
        /// <summary>
        /// Returns the metadata for one service or a list of the metadata for all services. Use
        /// this without a service code to get the service codes for all services. Use it with
        /// a service code, such as <code>AmazonEC2</code>, to get information specific to that
        /// service, such as the attribute names available for that service. For example, some
        /// of the attribute names available for EC2 are <code>volumeType</code>, <code>maxIopsVolume</code>,
        /// <code>operation</code>, <code>locationType</code>, and <code>instanceCapacity10xlarge</code>.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DescribeServices service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the DescribeServices service method, as returned by Pricing.</returns>
        /// <exception cref="Amazon.Pricing.Model.ExpiredNextTokenException">
        /// The pagination token expired. Try again without a pagination token.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.InternalErrorException">
        /// An error on the server occurred during the processing of your request. Try again later.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.InvalidNextTokenException">
        /// The pagination token is invalid. Try again without a pagination token.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.InvalidParameterException">
        /// One or more parameters had an invalid value.
        /// </exception>
        /// <exception cref="Amazon.Pricing.Model.NotFoundException">
        /// The requested resource can't be found.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
        public virtual Task <DescribeServicesResponse> DescribeServicesAsync(DescribeServicesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DescribeServicesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DescribeServicesResponseUnmarshaller.Instance;

            return(InvokeAsync <DescribeServicesResponse>(request, options, cancellationToken));
        }
        private async threadingTask.Task <bool> DoesServiceExist()
        {
            var request = new DescribeServicesRequest
            {
                Cluster  = DefaultSettings.General.ClusterName,
                Services = new List <string> {
                    DefaultSettings.General.ServiceName
                }
            };

            var response = await ECSClient.DescribeServicesAsync(request);

            return(response.Services.Any());
        }
        internal DescribeServicesResponse DescribeServices(DescribeServicesRequest request)
        {
            var task = DescribeServicesAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
Exemple #11
0
        /// <summary>
        /// 描述服务
        /// </summary>
        /// <param name="req"><see cref="DescribeServicesRequest"/></param>
        /// <returns><see cref="DescribeServicesResponse"/></returns>
        public DescribeServicesResponse DescribeServicesSync(DescribeServicesRequest req)
        {
            JsonResponseModel <DescribeServicesResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "DescribeServices");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DescribeServicesResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Exemple #12
0
        private async Task <Service> DescribeService(EcsDeployContext context, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            var request = new DescribeServicesRequest
            {
                Cluster  = context.ClusterName,
                Services = new List <string> {
                    context.ServiceName
                },
            };

            var response = await ecs.DescribeServicesAsync(request, cancellationToken);

            var service = response.Services.First();

            return(service);
        }
        private async Task <bool> WaitTillUpdateServiceComplete(DescribeServicesRequest describeRequest)
        {
            long    start   = DateTime.Now.Ticks;
            Service service = null;

            do
            {
                Thread.Sleep(1000);
                service = (await this.ECSClient.DescribeServicesAsync(describeRequest)).Services[0];
            } while (service.Deployments.Count != 1 &&
                     TimeSpan.FromTicks(DateTime.Now.Ticks - start).TotalMinutes < 2);

            if (service.Deployments.Count != 1)
            {
                return(false);
            }

            return(true);
        }
Exemple #14
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonAWSSupportConfig config = new AmazonAWSSupportConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonAWSSupportClient client = new AmazonAWSSupportClient(creds, config);

            DescribeServicesResponse resp = new DescribeServicesResponse();
            DescribeServicesRequest  req  = new DescribeServicesRequest
            {
            };

            resp = client.DescribeServices(req);
            CheckError(resp.HttpStatusCode, "200");

            foreach (var obj in resp.Services)
            {
                AddObject(obj);
            }
        }
 /// <summary>
 ///  查询监控图可用的产品线列表
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public DescribeServicesResponse DescribeServices(DescribeServicesRequest request)
 {
     return(new DescribeServicesExecutor().Client(this).Execute <DescribeServicesResponse, DescribeServicesResult, DescribeServicesRequest>(request));
 }
 /// <summary>
 ///  查询监控图可用的产品线列表
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <DescribeServicesResponse> DescribeServices(DescribeServicesRequest request)
 {
     return(await new DescribeServicesExecutor().Client(this).Execute <DescribeServicesResponse, DescribeServicesResult, DescribeServicesRequest>(request).ConfigureAwait(false));
 }
        private async Task <bool> PerformRollingServiceDeployment(
            string cluster, string serviceName, string taskRevision)
        {
            var describeRequest = new DescribeServicesRequest
            {
                Cluster  = cluster,
                Services = new List <string> {
                    serviceName
                }
            };
            var originalService = (await this.ECSClient.DescribeServicesAsync(describeRequest)).Services[0];

            int totalTasks = originalService.DesiredCount;

            Console.Write("Reducing the number of tasks to {0} for existing definition...", totalTasks / 2);
            await this.ECSClient.UpdateServiceAsync(new UpdateServiceRequest
            {
                Cluster      = cluster,
                Service      = serviceName,
                DesiredCount = totalTasks / 2
            });

            if (!await WaitTillUpdateServiceComplete(describeRequest))
            {
                Console.Error.WriteLine("\nECS Cluster did not reduce the number of existing tasks.");
                return(false);
            }
            Console.WriteLine("Complete");

            Console.Write("Starting {0} task(s) with new definition...", totalTasks / 2);
            await this.ECSClient.UpdateServiceAsync(new UpdateServiceRequest
            {
                Cluster        = cluster,
                Service        = serviceName,
                TaskDefinition = taskRevision,
                DesiredCount   = totalTasks / 2
            });

            if (!await WaitTillUpdateServiceComplete(describeRequest))
            {
                Console.Error.WriteLine("\nECS Cluster did not start tasks with new task definition.");
                return(false);
            }
            Console.WriteLine("Complete");

            Console.Write("Starting remaining tasks with new task definition...");
            await this.ECSClient.UpdateServiceAsync(new UpdateServiceRequest
            {
                Cluster      = cluster,
                Service      = serviceName,
                DesiredCount = totalTasks
            });

            if (!await WaitTillUpdateServiceComplete(describeRequest))
            {
                Console.Error.WriteLine("\nECS Cluster did not start tasks with new task definition.");
                return(false);
            }
            Console.WriteLine("Complete with {0} total tasks", totalTasks);

            return(true);
        }