/// <summary>Snippet for CreateDomainMappingAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task CreateDomainMappingRequestObjectAsync()
        {
            // Create client
            DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync();

            // Initialize request argument(s)
            CreateDomainMappingRequest request = new CreateDomainMappingRequest
            {
                Parent           = "",
                DomainMapping    = new DomainMapping(),
                OverrideStrategy = DomainOverrideStrategy.UnspecifiedDomainOverrideStrategy,
            };
            // Make the request
            Operation <DomainMapping, OperationMetadataV1> response = await domainMappingsClient.CreateDomainMappingAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <DomainMapping, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            DomainMapping result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <DomainMapping, OperationMetadataV1> retrievedResponse = await domainMappingsClient.PollOnceCreateDomainMappingAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                DomainMapping retrievedResult = retrievedResponse.Result;
            }
        }
Exemple #2
0
        /// <summary>Snippet for DeleteDomainMappingAsync</summary>
        public async Task DeleteDomainMappingRequestObjectAsync()
        {
            // Snippet: DeleteDomainMappingAsync(DeleteDomainMappingRequest, CallSettings)
            // Additional: DeleteDomainMappingAsync(DeleteDomainMappingRequest, CancellationToken)
            // Create client
            DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteDomainMappingRequest request = new DeleteDomainMappingRequest {
                Name = "",
            };
            // Make the request
            Operation <Empty, OperationMetadataV1> response = await domainMappingsClient.DeleteDomainMappingAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadataV1> retrievedResponse = await domainMappingsClient.PollOnceDeleteDomainMappingAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Exemple #3
0
        /// <summary>Snippet for GetDomainMappingAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetDomainMappingRequestObjectAsync()
        {
            // Create client
            DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync();

            // Initialize request argument(s)
            GetDomainMappingRequest request = new GetDomainMappingRequest {
                Name = "",
            };
            // Make the request
            DomainMapping response = await domainMappingsClient.GetDomainMappingAsync(request);
        }
Exemple #4
0
        /// <summary>Snippet for GetDomainMappingAsync</summary>
        public async Task GetDomainMappingRequestObjectAsync()
        {
            // Snippet: GetDomainMappingAsync(GetDomainMappingRequest, CallSettings)
            // Additional: GetDomainMappingAsync(GetDomainMappingRequest, CancellationToken)
            // Create client
            DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync();

            // Initialize request argument(s)
            GetDomainMappingRequest request = new GetDomainMappingRequest {
                Name = "",
            };
            // Make the request
            DomainMapping response = await domainMappingsClient.GetDomainMappingAsync(request);

            // End snippet
        }
Exemple #5
0
        /// <summary>Snippet for ListDomainMappingsAsync</summary>
        public async Task ListDomainMappingsRequestObjectAsync()
        {
            // Snippet: ListDomainMappingsAsync(ListDomainMappingsRequest, CallSettings)
            // Create client
            DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync();

            // Initialize request argument(s)
            ListDomainMappingsRequest request = new ListDomainMappingsRequest {
                Parent = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListDomainMappingsResponse, DomainMapping> response = domainMappingsClient.ListDomainMappingsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((DomainMapping 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((ListDomainMappingsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (DomainMapping 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 <DomainMapping> 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 (DomainMapping 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
        }