Beispiel #1
0
        /// <summary>Snippet for DeleteSchemaAsync</summary>
        public async Task DeleteSchemaResourceNamesAsync()
        {
            // Snippet: DeleteSchemaAsync(SchemaName, CallSettings)
            // Additional: DeleteSchemaAsync(SchemaName, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            SchemaName name = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]");
            // Make the request
            await schemaServiceClient.DeleteSchemaAsync(name);

            // End snippet
        }
Beispiel #2
0
        /// <summary>Snippet for DeleteSchemaAsync</summary>
        public async Task DeleteSchemaAsync()
        {
            // Snippet: DeleteSchemaAsync(string, CallSettings)
            // Additional: DeleteSchemaAsync(string, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/schemas/[SCHEMA]";
            // Make the request
            await schemaServiceClient.DeleteSchemaAsync(name);

            // End snippet
        }
Beispiel #3
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
        }
Beispiel #4
0
        /// <summary>Snippet for ValidateSchemaAsync</summary>
        public async Task ValidateSchemaResourceNamesAsync()
        {
            // Snippet: ValidateSchemaAsync(ProjectName, Schema, CallSettings)
            // Additional: ValidateSchemaAsync(ProjectName, Schema, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName parent = ProjectName.FromProject("[PROJECT]");
            Schema      schema = new Schema();
            // Make the request
            ValidateSchemaResponse response = await schemaServiceClient.ValidateSchemaAsync(parent, schema);

            // End snippet
        }
Beispiel #5
0
        /// <summary>Snippet for ValidateSchemaAsync</summary>
        public async Task ValidateSchemaAsync()
        {
            // Snippet: ValidateSchemaAsync(string, Schema, CallSettings)
            // Additional: ValidateSchemaAsync(string, Schema, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]";
            Schema schema = new Schema();
            // Make the request
            ValidateSchemaResponse response = await schemaServiceClient.ValidateSchemaAsync(parent, schema);

            // End snippet
        }
Beispiel #6
0
        /// <summary>Snippet for DeleteSchemaAsync</summary>
        public async Task DeleteSchemaRequestObjectAsync()
        {
            // Snippet: DeleteSchemaAsync(DeleteSchemaRequest, CallSettings)
            // Additional: DeleteSchemaAsync(DeleteSchemaRequest, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteSchemaRequest request = new DeleteSchemaRequest
            {
                SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
            };
            // Make the request
            await schemaServiceClient.DeleteSchemaAsync(request);

            // End snippet
        }
Beispiel #7
0
        /// <summary>Snippet for ValidateSchemaAsync</summary>
        public async Task ValidateSchemaRequestObjectAsync()
        {
            // Snippet: ValidateSchemaAsync(ValidateSchemaRequest, CallSettings)
            // Additional: ValidateSchemaAsync(ValidateSchemaRequest, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            ValidateSchemaRequest request = new ValidateSchemaRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                Schema = new Schema(),
            };
            // Make the request
            ValidateSchemaResponse response = await schemaServiceClient.ValidateSchemaAsync(request);

            // End snippet
        }
Beispiel #8
0
        /// <summary>Snippet for GetSchemaAsync</summary>
        public async Task GetSchemaRequestObjectAsync()
        {
            // Snippet: GetSchemaAsync(GetSchemaRequest, CallSettings)
            // Additional: GetSchemaAsync(GetSchemaRequest, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetSchemaRequest request = new GetSchemaRequest
            {
                SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
                View       = SchemaView.Unspecified,
            };
            // Make the request
            Schema response = await schemaServiceClient.GetSchemaAsync(request);

            // End snippet
        }
Beispiel #9
0
        /// <summary>Snippet for ValidateMessageAsync</summary>
        public async Task ValidateMessageRequestObjectAsync()
        {
            // Snippet: ValidateMessageAsync(ValidateMessageRequest, CallSettings)
            // Additional: ValidateMessageAsync(ValidateMessageRequest, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            ValidateMessageRequest request = new ValidateMessageRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                SchemaName          = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
                Message             = ByteString.Empty,
                Encoding            = Encoding.Unspecified,
            };
            // Make the request
            ValidateMessageResponse response = await schemaServiceClient.ValidateMessageAsync(request);

            // End snippet
        }