Ejemplo n.º 1
0
        IAsyncResult invokeListDatasets(ListDatasetsRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller   = new ListDatasetsRequestMarshaller();
            var unmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Lists datasets for an identity.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListDatasets service method.</param>
        ///
        /// <returns>The response from the ListDatasets service method, as returned by CognitoSync.</returns>
        /// <exception cref="InternalErrorException">
        /// Indicates an internal service error.
        /// </exception>
        /// <exception cref="InvalidParameterException">
        /// Thrown when a request parameter does not comply with the associated constraints.
        /// </exception>
        /// <exception cref="NotAuthorizedException">
        /// Thrown when a user is not authorized to access the requested resource.
        /// </exception>
        public ListDatasetsResponse ListDatasets(ListDatasetsRequest request)
        {
            var marshaller   = new ListDatasetsRequestMarshaller();
            var unmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(Invoke <ListDatasetsRequest, ListDatasetsResponse>(request, marshaller, unmarshaller));
        }
Ejemplo n.º 3
0
        internal virtual ListDatasetsResponse ListDatasets(ListDatasetsRequest request)
        {
            var marshaller   = ListDatasetsRequestMarshaller.Instance;
            var unmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(Invoke <ListDatasetsRequest, ListDatasetsResponse>(request, marshaller, unmarshaller));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListDatasets operation.
        /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListDatasets 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 <ListDatasetsResponse> ListDatasetsAsync(ListDatasetsRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new ListDatasetsRequestMarshaller();
            var unmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(Invoke <IRequest, ListDatasetsRequest, ListDatasetsResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
Ejemplo n.º 5
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonIoTAnalyticsConfig config = new AmazonIoTAnalyticsConfig();

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

            ListDatasetsResponse resp = new ListDatasetsResponse();

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

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

                foreach (var obj in resp.DatasetSummaries)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        private static ListDatasetsRequest PrepareListDatasetsRequest()
        {
            ListDatasetsRequest request = new ListDatasetsRequest();

            // a large enough number to reduce # of requests
            request.MaxResults = 64;
            return(request);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListDatasets operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListDatasets 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/cognito-sync-2014-06-30/ListDatasets">REST API Reference for ListDatasets Operation</seealso>
        public virtual Task <ListDatasetsResponse> ListDatasetsAsync(ListDatasetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = ListDatasetsRequestMarshaller.Instance;
            var unmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(InvokeAsync <ListDatasetsRequest, ListDatasetsResponse>(request, marshaller,
                                                                           unmarshaller, cancellationToken));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListDatasets operation.
        /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListDatasets operation on AmazonCognitoSyncClient.</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 EndListDatasets
        ///         operation.</returns>
        public IAsyncResult BeginListDatasets(ListDatasetsRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new ListDatasetsRequestMarshaller();
            var unmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(BeginInvoke <ListDatasetsRequest>(request, marshaller, unmarshaller,
                                                     callback, state));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListDatasets operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListDatasets 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/cognito-sync-2014-06-30/ListDatasets">REST API Reference for ListDatasets Operation</seealso>
        public virtual Task <ListDatasetsResponse> ListDatasetsAsync(ListDatasetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListDatasetsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(InvokeAsync <ListDatasetsResponse>(request, options, cancellationToken));
        }
Ejemplo n.º 10
0
        internal virtual ListDatasetsResponse ListDatasets(ListDatasetsRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListDatasetsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListDatasetsResponseUnmarshaller.Instance;

            return(Invoke <ListDatasetsResponse>(request, options));
        }
Ejemplo n.º 11
0
        internal ListDatasetsResponse ListDatasets(ListDatasetsRequest request)
        {
            var task = ListDatasetsAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
Ejemplo n.º 12
0
        /// <summary>Snippet for ListDatasets</summary>
        public async Task ListDatasetsRequestObjectAsync()
        {
            // Snippet: ListDatasetsAsync(ListDatasetsRequest, CallSettings)
            // Create client
            AutoMlClient autoMlClient = await AutoMlClient.CreateAsync();

            // Initialize request argument(s)
            ListDatasetsRequest request = new ListDatasetsRequest
            {
                Parent = "",
                Filter = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListDatasetsResponse, Dataset> response = autoMlClient.ListDatasetsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Dataset item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListDatasetsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Dataset item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int            pageSize   = 10;
            Page <Dataset> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Dataset item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for ListDatasets</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListDatasetsRequestObject()
        {
            // Create client
            AutoMlClient autoMlClient = AutoMlClient.Create();
            // Initialize request argument(s)
            ListDatasetsRequest request = new ListDatasetsRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Filter = "",
            };
            // Make the request
            PagedEnumerable <ListDatasetsResponse, Dataset> response = autoMlClient.ListDatasets(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Dataset item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListDatasetsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Dataset item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int            pageSize   = 10;
            Page <Dataset> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Dataset item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListDatasets operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListDatasets operation on AmazonCognitoSyncClient.</param>
        /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
        /// <param name="options">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>
        public void ListDatasetsAsync(ListDatasetsRequest request, AmazonServiceCallback <ListDatasetsRequest, ListDatasetsResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller   = new ListDatasetsRequestMarshaller();
            var unmarshaller = ListDatasetsResponseUnmarshaller.Instance;
            Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;

            if (callback != null)
            {
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => {
                    AmazonServiceResult <ListDatasetsRequest, ListDatasetsResponse> responseObject
                        = new AmazonServiceResult <ListDatasetsRequest, ListDatasetsResponse>((ListDatasetsRequest)req, (ListDatasetsResponse)res, ex, ao.State);
                    callback(responseObject);
                }
            }
            ;
            BeginInvoke <ListDatasetsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }
Ejemplo n.º 15
0
        private static IEnumerable <Dataset> GetAllDatasetsHelper(string poolId, string identityId)
        {
            var request = new ListDatasetsRequest
            {
                MaxResults     = MaxResults,
                IdentityPoolId = poolId,
                IdentityId     = identityId
            };
            ListDatasetsResult result;

            do
            {
                result = Client.ListDatasets(request);
                foreach (var ds in result.Datasets)
                {
                    yield return(ds);
                }

                request.NextToken = result.NextToken;
            } while (!string.IsNullOrEmpty(result.NextToken));
        }
        private void PopulateGetDatasets(string nextToken, List <DatasetMetadata> datasets, AmazonCognitoCallback callback, object state)
        {
            ListDatasetsRequest request = new ListDatasetsRequest();

            //appendUserAgent(request, userAgent);
            request.IdentityPoolId = identityPoolId;
            request.IdentityId     = this.GetCurrentIdentityId();
            // a large enough number to reduce # of requests
            request.MaxResults = 64;
            request.NextToken  = nextToken;

            client.ListDatasetsAsync(request, delegate(AmazonServiceResult result)
            {
                if (result.Exception != null)
                {
                    AmazonMainThreadDispatcher.ExecCallback(callback, new AmazonCognitoResult(null,
                                                                                              HandleException(result.Exception, "Failed to list dataset metadata"), state));
                    return;
                }

                ListDatasetsResponse response = result.Response as ListDatasetsResponse;
                foreach (Amazon.CognitoSync.Model.Dataset dataset in response.Datasets)
                {
                    datasets.Add(ModelToDatasetMetadata(dataset));
                }

                nextToken = response.NextToken;

                if (nextToken == null)
                {
                    GetDatasetsResponse getDatasetsResponse = new GetDatasetsResponse
                    {
                        Datasets = datasets
                    };
                    AmazonMainThreadDispatcher.ExecCallback(callback, new AmazonCognitoResult(getDatasetsResponse, null, state));
                    return;
                }
                PopulateGetDatasets(nextToken, datasets, callback, state);
            }, null);
        }
Ejemplo n.º 17
0
        private async Task <List <DatasetMetadata> > PopulateListDatasetMetadata(string nextToken, List <DatasetMetadata> datasets, CancellationToken cancellationToken)
        {
            ListDatasetsRequest request = new ListDatasetsRequest();

            // a large enough number to reduce # of requests
            request.MaxResults = 64;
            request.NextToken  = nextToken;

            ListDatasetsResponse response = await client.ListDatasetsAsync(request, cancellationToken).ConfigureAwait(false);

            foreach (Amazon.CognitoSync.Model.Dataset dataset in response.Datasets)
            {
                datasets.Add(ModelToDatasetMetadata(dataset));
            }
            nextToken = response.NextToken;

            if (nextToken != null)
            {
                await PopulateListDatasetMetadata(nextToken, datasets, cancellationToken).ConfigureAwait(false);
            }
            return(datasets);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListDatasetsRequest request;

            try
            {
                request = new ListDatasetsRequest
                {
                    CompartmentId    = CompartmentId,
                    Id               = Id,
                    AnnotationFormat = AnnotationFormat,
                    LifecycleState   = LifecycleState,
                    DisplayName      = DisplayName,
                    Limit            = Limit,
                    Page             = Page,
                    SortOrder        = SortOrder,
                    SortBy           = SortBy,
                    OpcRequestId     = OpcRequestId
                };
                IEnumerable <ListDatasetsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.DatasetCollection, 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);
            }
        }
Ejemplo n.º 19
0
        private List <DatasetMetadata> PopulateListDatasetMetadata(string nextToken, List <DatasetMetadata> datasets)
        {
            ListDatasetsRequest request = new ListDatasetsRequest();

            // a large enough number to reduce # of requests
            request.MaxResults = 64;
            request.NextToken  = nextToken;

            ListDatasetsResponse response = client.ListDatasets(request);

            foreach (Amazon.CognitoSync.Model.Dataset dataset in response.Datasets)
            {
                datasets.Add(ModelToDatasetMetadata(dataset));
            }

            nextToken = response.NextToken;

            if (nextToken != null)
            {
                PopulateListDatasetMetadata(nextToken, datasets);
            }

            return(datasets);
        }
        private void PopulateGetDatasetMetadataAsync(string nextToken, List <DatasetMetadata> datasets, AmazonCognitoSyncCallback <List <DatasetMetadata> > callback, AsyncOptions options)
        {
            ListDatasetsRequest request = new ListDatasetsRequest();

            // a large enough number to reduce # of requests
            request.MaxResults = 64;
            request.NextToken  = nextToken;

            client.ListDatasetsAsync(request, (responseObj) =>
            {
                Exception ex = responseObj.Exception;
                ListDatasetsResponse response = responseObj.Response;
                object obj = responseObj.state;
                if (ex != null)
                {
                    InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult <List <DatasetMetadata> >(null, ex, obj)), options);
                }
                else
                {
                    foreach (Amazon.CognitoSync.Model.Dataset dataset in response.Datasets)
                    {
                        datasets.Add(ModelToDatasetMetadata(dataset));
                    }

                    nextToken = response.NextToken;

                    if (nextToken == null)
                    {
                        InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult <List <DatasetMetadata> >(datasets, null, obj)), options);
                        return;
                    }
                    PopulateGetDatasetMetadataAsync(nextToken, datasets, callback, options);
                }
            },
                                     options);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Lists datasets for an identity.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListDatasets service method.</param>
        ///
        /// <returns>The response from the ListDatasets service method, as returned by CognitoSync.</returns>
        /// <exception cref="InternalErrorException">
        /// Indicates an internal service error.
        /// </exception>
        /// <exception cref="InvalidParameterException">
        /// Thrown when a request parameter does not comply with the associated constraints.
        /// </exception>
        /// <exception cref="NotAuthorizedException">
        /// Thrown when a user is not authorized to access the requested resource.
        /// </exception>
        public ListDatasetsResponse ListDatasets(ListDatasetsRequest request)
        {
            IAsyncResult asyncResult = invokeListDatasets(request, null, null, true);

            return(EndListDatasets(asyncResult));
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Initiates the asynchronous execution of the ListDatasets operation.
 /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync"/>
 /// </summary>
 ///
 /// <param name="request">Container for the necessary parameters to execute the ListDatasets operation on AmazonCognitoSyncClient.</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 EndListDatasets
 ///         operation.</returns>
 public IAsyncResult BeginListDatasets(ListDatasetsRequest request, AsyncCallback callback, object state)
 {
     return(invokeListDatasets(request, callback, state, false));
 }