public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonSyntheticsConfig config = new AmazonSyntheticsConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonSyntheticsClient client = new AmazonSyntheticsClient(creds, config); DescribeCanariesResponse resp = new DescribeCanariesResponse(); do { DescribeCanariesRequest req = new DescribeCanariesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.DescribeCanaries(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Canaries) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// This operation returns a list of the canaries in your account, along with full details /// about each canary. /// /// /// <para> /// This operation supports resource-level authorization using an IAM policy and the <code>Names</code> /// parameter. If you specify the <code>Names</code> parameter, the operation is successful /// only if you have authorization to view all the canaries that you specify in your request. /// If you do not have permission to view any of the canaries, the request fails with /// a 403 response. /// </para> /// /// <para> /// You are required to use the <code>Names</code> parameter if you are logged on to a /// user or role that has an IAM policy that restricts which canaries that you are allowed /// to view. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Restricted.html"> /// Limiting a user to viewing specific canaries</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeCanaries 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 DescribeCanaries service method, as returned by Synthetics.</returns> /// <exception cref="Amazon.Synthetics.Model.InternalServerException"> /// An unknown internal error occurred. /// </exception> /// <exception cref="Amazon.Synthetics.Model.ValidationException"> /// A parameter could not be validated. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/synthetics-2017-10-11/DescribeCanaries">REST API Reference for DescribeCanaries Operation</seealso> public virtual Task <DescribeCanariesResponse> DescribeCanariesAsync(DescribeCanariesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeCanariesRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeCanariesResponseUnmarshaller.Instance; return(InvokeAsync <DescribeCanariesResponse>(request, options, cancellationToken)); }
internal virtual DescribeCanariesResponse DescribeCanaries(DescribeCanariesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeCanariesRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeCanariesResponseUnmarshaller.Instance; return(Invoke <DescribeCanariesResponse>(request, options)); }