Example #1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListExportsRequest request;

            try
            {
                request = new ListExportsRequest
                {
                    CompartmentId  = CompartmentId,
                    Limit          = Limit,
                    Page           = Page,
                    ExportSetId    = ExportSetId,
                    FileSystemId   = FileSystemId,
                    LifecycleState = LifecycleState,
                    Id             = Id,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder,
                    OpcRequestId   = OpcRequestId
                };
                IEnumerable <ListExportsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonCloudFormationConfig config = new AmazonCloudFormationConfig();

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

            ListExportsResponse resp = new ListExportsResponse();

            do
            {
                ListExportsRequest req = new ListExportsRequest
                {
                    NextToken = resp.NextToken
                };

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

                foreach (var obj in resp.Exports)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /**
         * Displays the export paths
         *
         * @param fsClient the service client to use to retrieve the exports
         * @param listExportsRequest contains the parameters and filters to get the exports
         */
        private static void IterateExports(FileStorageClient fsClient, ListExportsRequest listExportsRequest)
        {
            IEnumerable <ExportSummary> exportSummaries = fsClient.Paginators.ListExportsRecordEnumerator(listExportsRequest);

            foreach (ExportSummary exportSummary in exportSummaries)
            {
                logger.Info($"Export path: {exportSummary.Path}");
            }
        }
Example #4
0
 /// <summary>
 /// Creates a new enumerable which will iterate over the responses received from the ListExports operation. This enumerable
 /// will fetch more data from the server as needed.
 /// </summary>
 /// <param name="request">The request object containing the details to send</param>
 /// <param name="retryConfiguration">The configuration for retrying, may be null</param>
 /// <param name="cancellationToken">The cancellation token object</param>
 /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns>
 public IEnumerable <ListExportsResponse> ListExportsResponseEnumerator(ListExportsRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseEnumerable <ListExportsRequest, ListExportsResponse>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListExports(request, retryConfiguration, cancellationToken)
                ));
 }
        /**
         * Demonstrates how to list exports and using various criteria. Note that listing exports is a paginated call, so we should
         * get all pages until there is no more opcNextPage token
         *
         * @param fsClient the service client used to communicate with the File Storage service
         * @param compartmentId the OCID of the compartment which owns the resources
         * @param fileSystem the file system which we're working with
         * @param mountTarget the mount target which we're working with
         */
        private static void ListExports(FileStorageClient fsClient, String compartmentId, FileSystem fileSystem, MountTarget mountTarget)
        {
            // The most basic call is to list exports by comparment ID
            ListExportsRequest listExportsRequest = new ListExportsRequest
            {
                CompartmentId = compartmentId
            };

            logger.Info("Listing exports by compartment ID");
            IterateExports(fsClient, listExportsRequest);

            // We can find all exports in a given export set
            listExportsRequest.ExportSetId = mountTarget.ExportSetId;
            logger.Info("Listing exports by export set");
            IterateExports(fsClient, listExportsRequest);

            // We can find all exports for a given file system
            listExportsRequest.ExportSetId  = null;
            listExportsRequest.FileSystemId = fileSystem.Id;
            logger.Info("Listing exports by file system");
            IterateExports(fsClient, listExportsRequest);
        }
Example #6
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListExportsRequest request;

            try
            {
                request = new ListExportsRequest
                {
                    CompartmentId  = CompartmentId,
                    Limit          = Limit,
                    Page           = Page,
                    ExportSetId    = ExportSetId,
                    FileSystemId   = FileSystemId,
                    LifecycleState = LifecycleState,
                    Id             = Id,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder,
                    OpcRequestId   = OpcRequestId
                };
                IEnumerable <ListExportsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, 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);
            }
        }
Example #7
0
 Task <ListExportsResponse> IAmazonDynamoDB.ListExportsAsync(ListExportsRequest request, CancellationToken cancellationToken)
 {
     throw new NotSupportedException();
 }
Example #8
0
 public Task <ListExportsResponse> ListExportsAsync(ListExportsRequest request, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }