public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonSimpleSystemsManagementConfig config = new AmazonSimpleSystemsManagementConfig();

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

            ListAssociationsResponse resp = new ListAssociationsResponse();

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

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

                foreach (var obj in resp.Associations)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        internal ListAssociationsResponse ListAssociations(ListAssociationsRequest request)
        {
            var marshaller   = new ListAssociationsRequestMarshaller();
            var unmarshaller = ListAssociationsResponseUnmarshaller.Instance;

            return(Invoke <ListAssociationsRequest, ListAssociationsResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ListAssociations operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListAssociations 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>
        public Task <ListAssociationsResponse> ListAssociationsAsync(ListAssociationsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new ListAssociationsRequestMarshaller();
            var unmarshaller = ListAssociationsResponseUnmarshaller.Instance;

            return(InvokeAsync <ListAssociationsRequest, ListAssociationsResponse>(request, marshaller,
                                                                                   unmarshaller, cancellationToken));
        }
Exemple #4
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListAssociationsRequest request;

            try
            {
                request = new ListAssociationsRequest
                {
                    OpcRequestId           = OpcRequestId,
                    CompartmentId          = CompartmentId,
                    CertificatesResourceId = CertificatesResourceId,
                    AssociatedResourceId   = AssociatedResourceId,
                    AssociationId          = AssociationId,
                    Name            = Name,
                    SortBy          = SortBy,
                    SortOrder       = SortOrder,
                    Limit           = Limit,
                    Page            = Page,
                    AssociationType = AssociationType
                };
                IEnumerable <ListAssociationsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.AssociationCollection, true);
                }
                if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null)
                {
                    WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources.");
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }