protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListSchemasRequest request;

            try
            {
                request = new ListSchemasRequest
                {
                    WorkspaceId        = WorkspaceId,
                    ConnectionKey      = ConnectionKey,
                    SchemaResourceName = SchemaResourceName,
                    Page         = Page,
                    Limit        = Limit,
                    Fields       = Fields,
                    SortBy       = SortBy,
                    SortOrder    = SortOrder,
                    Name         = Name,
                    OpcRequestId = OpcRequestId
                };
                IEnumerable <ListSchemasResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.SchemaSummaryCollection, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Beispiel #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonGlueConfig config = new AmazonGlueConfig();

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

            ListSchemasResponse resp = new ListSchemasResponse();

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

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

                foreach (var obj in resp.Schemas)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /// <summary>
        /// Lists the schemas in a database. A token is returned to page through the schema list.
        /// Depending on the authorization method, use one of the following combinations of request
        /// parameters:
        ///
        ///  <ul> <li>
        /// <para>
        /// AWS Secrets Manager - specify the Amazon Resource Name (ARN) of the secret and the
        /// cluster identifier that matches the cluster in the secret.
        /// </para>
        ///  </li> <li>
        /// <para>
        /// Temporary credentials - specify the cluster identifier, the database name, and the
        /// database user name. Permission to call the <code>redshift:GetClusterCredentials</code>
        /// operation is required to use this method.
        /// </para>
        ///  </li> </ul>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListSchemas 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 ListSchemas service method, as returned by RedshiftDataAPIService.</returns>
        /// <exception cref="Amazon.RedshiftDataAPIService.Model.InternalServerException">
        /// The Amazon Redshift Data API operation failed due to invalid input.
        /// </exception>
        /// <exception cref="Amazon.RedshiftDataAPIService.Model.ValidationException">
        /// The Amazon Redshift Data API operation failed due to invalid input.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/redshift-data-2019-12-20/ListSchemas">REST API Reference for ListSchemas Operation</seealso>
        public virtual Task <ListSchemasResponse> ListSchemasAsync(ListSchemasRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListSchemasRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListSchemasResponseUnmarshaller.Instance;

            return(InvokeAsync <ListSchemasResponse>(request, options, cancellationToken));
        }
        internal virtual ListSchemasResponse ListSchemas(ListSchemasRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListSchemasRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListSchemasResponseUnmarshaller.Instance;

            return(Invoke <ListSchemasResponse>(request, options));
        }
Beispiel #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListSchemas operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListSchemas operation on AmazonRedshiftDataAPIServiceClient.</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 EndListSchemas
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/redshift-data-2019-12-20/ListSchemas">REST API Reference for ListSchemas Operation</seealso>
        public virtual IAsyncResult BeginListSchemas(ListSchemasRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListSchemasRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListSchemasResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
        private async Task PopulateSchemasList(string filter)
        {
            var client  = new AmazonSchemasClient();
            var request = new ListSchemasRequest {
                RegistryName = "aws.events", SchemaNamePrefix = filter
            };

            var response = await client.ListSchemasAsync(request);

            SchemaNames.AddRange(response.Schemas.Select(x => new SelectListItem {
                Value = x.SchemaName, Text = x.SchemaName
            }));
        }
Beispiel #7
0
        /// <summary>Snippet for ListSchemas</summary>
        public async Task ListSchemasRequestObjectAsync()
        {
            // Snippet: ListSchemasAsync(ListSchemasRequest, CallSettings)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListSchemasRequest request = new ListSchemasRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                View = SchemaView.Unspecified,
            };
            // Make the request
            PagedAsyncEnumerable <ListSchemasResponse, Schema> response = schemaServiceClient.ListSchemasAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Schema 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((ListSchemasResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Schema 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 <Schema> 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 (Schema 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
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListSchemasRequest request;

            try
            {
                request = new ListSchemasRequest
                {
                    RegistryId        = RegistryId,
                    ConnectionKey     = ConnectionKey,
                    Page              = Page,
                    Limit             = Limit,
                    Fields            = Fields,
                    SortBy            = SortBy,
                    SortOrder         = SortOrder,
                    SchemaResourceKey = SchemaResourceKey,
                    Name              = Name,
                    OpcRequestId      = OpcRequestId,
                    NameList          = NameList,
                    EndpointId        = EndpointId
                };
                IEnumerable <ListSchemasResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.SchemaSummaryCollection, 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);
            }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListSchemasRequest request;

            try
            {
                request = new ListSchemasRequest
                {
                    TargetDatabaseId   = TargetDatabaseId,
                    OpcRequestId       = OpcRequestId,
                    Limit              = Limit,
                    Page               = Page,
                    SchemaName         = SchemaName,
                    SortOrder          = SortOrder,
                    SortBy             = SortBy,
                    IsOracleMaintained = IsOracleMaintained,
                    SchemaNameContains = SchemaNameContains
                };
                IEnumerable <ListSchemasResponse> 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);
            }
        }