/// <summary>Snippet for EnableServiceAsync</summary>
        public async Task EnableServiceRequestObjectAsync()
        {
            // Snippet: EnableServiceAsync(EnableServiceRequest, CallSettings)
            // Additional: EnableServiceAsync(EnableServiceRequest, CancellationToken)
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            EnableServiceRequest request = new EnableServiceRequest {
                Name = "",
            };
            // Make the request
            Operation <EnableServiceResponse, OperationMetadata> response = await serviceUsageClient.EnableServiceAsync(request);

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

            // Retrieve the operation result
            EnableServiceResponse 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 <EnableServiceResponse, OperationMetadata> retrievedResponse = await serviceUsageClient.PollOnceEnableServiceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                EnableServiceResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for GenerateServiceIdentityAsync</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 GenerateServiceIdentityRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            GenerateServiceIdentityRequest request = new GenerateServiceIdentityRequest {
                Parent = "",
            };
            // Make the request
            Operation <ServiceIdentity, Empty> response = await serviceUsageClient.GenerateServiceIdentityAsync(request);

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

            // Retrieve the operation result
            ServiceIdentity 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 <ServiceIdentity, Empty> retrievedResponse = await serviceUsageClient.PollOnceGenerateServiceIdentityAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ServiceIdentity retrievedResult = retrievedResponse.Result;
            }
        }
Exemplo n.º 3
0
        /// <summary>Snippet for BatchEnableServicesAsync</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 BatchEnableServicesRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            BatchEnableServicesRequest request = new BatchEnableServicesRequest
            {
                Parent     = "",
                ServiceIds = { "", },
            };
            // Make the request
            Operation <BatchEnableServicesResponse, OperationMetadata> response = await serviceUsageClient.BatchEnableServicesAsync(request);

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

            // Retrieve the operation result
            BatchEnableServicesResponse 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 <BatchEnableServicesResponse, OperationMetadata> retrievedResponse = await serviceUsageClient.PollOnceBatchEnableServicesAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                BatchEnableServicesResponse retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for DisableServiceAsync</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 DisableServiceRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            DisableServiceRequest request = new DisableServiceRequest
            {
                Name = "",
                DisableDependentServices = false,
                CheckIfServiceHasUsage   = DisableServiceRequest.Types.CheckIfServiceHasUsage.Unspecified,
            };
            // Make the request
            Operation <DisableServiceResponse, OperationMetadata> response = await serviceUsageClient.DisableServiceAsync(request);

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

            // Retrieve the operation result
            DisableServiceResponse 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 <DisableServiceResponse, OperationMetadata> retrievedResponse = await serviceUsageClient.PollOnceDisableServiceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                DisableServiceResponse retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for GetServiceAsync</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 GetServiceRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            GetServiceRequest request = new GetServiceRequest {
                Name = "",
            };
            // Make the request
            Service response = await serviceUsageClient.GetServiceAsync(request);
        }
        /// <summary>Snippet for GetConsumerQuotaMetricAsync</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 GetConsumerQuotaMetricRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            GetConsumerQuotaMetricRequest request = new GetConsumerQuotaMetricRequest
            {
                Name = "",
                View = QuotaView.Unspecified,
            };
            // Make the request
            ConsumerQuotaMetric response = await serviceUsageClient.GetConsumerQuotaMetricAsync(request);
        }
        /// <summary>Snippet for ListServicesAsync</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 ListServicesRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            ListServicesRequest request = new ListServicesRequest
            {
                Parent = "",
                Filter = "",
            };

            // Make the request
#pragma warning disable CS0612
            PagedAsyncEnumerable <ListServicesResponse, Service> response = serviceUsageClient.ListServicesAsync(request);
#pragma warning restore CS0612

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Service 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((ListServicesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Service 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 <Service> 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 (Service 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;
        }
        /// <summary>Snippet for BatchGetServicesAsync</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 BatchGetServicesRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            BatchGetServicesRequest request = new BatchGetServicesRequest
            {
                Parent = "",
                Names  = { "", },
            };
            // Make the request
            BatchGetServicesResponse response = await serviceUsageClient.BatchGetServicesAsync(request);
        }
        /// <summary>Snippet for GetServiceAsync</summary>
        public async Task GetServiceRequestObjectAsync()
        {
            // Snippet: GetServiceAsync(GetServiceRequest, CallSettings)
            // Additional: GetServiceAsync(GetServiceRequest, CancellationToken)
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            GetServiceRequest request = new GetServiceRequest {
                Name = "",
            };
            // Make the request
            Service response = await serviceUsageClient.GetServiceAsync(request);

            // End snippet
        }
Exemplo n.º 10
0
        /// <summary>Snippet for GetServiceAsync</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 GetServiceRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            GetServiceRequest request = new GetServiceRequest {
                Name = "",
            };

            // Make the request
#pragma warning disable CS0612
            Service response = await serviceUsageClient.GetServiceAsync(request);

#pragma warning restore CS0612
        }
        /// <summary>Snippet for BatchGetServicesAsync</summary>
        public async Task BatchGetServicesRequestObjectAsync()
        {
            // Snippet: BatchGetServicesAsync(BatchGetServicesRequest, CallSettings)
            // Additional: BatchGetServicesAsync(BatchGetServicesRequest, CancellationToken)
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            BatchGetServicesRequest request = new BatchGetServicesRequest
            {
                Parent = "",
                Names  = { "", },
            };
            // Make the request
            BatchGetServicesResponse response = await serviceUsageClient.BatchGetServicesAsync(request);

            // End snippet
        }
Exemplo n.º 12
0
        /// <summary>Snippet for UpdateConsumerOverrideAsync</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 UpdateConsumerOverrideRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            UpdateConsumerOverrideRequest request = new UpdateConsumerOverrideRequest
            {
                Name       = "",
                Override   = new QuotaOverride(),
                Force      = false,
                UpdateMask = new FieldMask(),
                ForceOnly  =
                {
                    QuotaSafetyCheck.Unspecified,
                },
            };
            // Make the request
            Operation <QuotaOverride, OperationMetadata> response = await serviceUsageClient.UpdateConsumerOverrideAsync(request);

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

            // Retrieve the operation result
            QuotaOverride 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 <QuotaOverride, OperationMetadata> retrievedResponse = await serviceUsageClient.PollOnceUpdateConsumerOverrideAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                QuotaOverride retrievedResult = retrievedResponse.Result;
            }
        }
Exemplo n.º 13
0
        /// <summary>Snippet for ImportAdminOverridesAsync</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 ImportAdminOverridesRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            ImportAdminOverridesRequest request = new ImportAdminOverridesRequest
            {
                Parent       = "",
                InlineSource = new OverrideInlineSource(),
                Force        = false,
                ForceOnly    =
                {
                    QuotaSafetyCheck.Unspecified,
                },
            };
            // Make the request
            Operation <ImportAdminOverridesResponse, ImportAdminOverridesMetadata> response = await serviceUsageClient.ImportAdminOverridesAsync(request);

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

            // Retrieve the operation result
            ImportAdminOverridesResponse 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 <ImportAdminOverridesResponse, ImportAdminOverridesMetadata> retrievedResponse = await serviceUsageClient.PollOnceImportAdminOverridesAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ImportAdminOverridesResponse retrievedResult = retrievedResponse.Result;
            }
        }
Exemplo n.º 14
0
        /// <summary>Snippet for EnableServiceAsync</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 EnableServiceRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            EnableServiceRequest request = new EnableServiceRequest {
                Name = "",
            };

            // Make the request
#pragma warning disable CS0612
            Operation <Empty, OperationMetadata> response = await serviceUsageClient.EnableServiceAsync(request);

#pragma warning restore CS0612

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> 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
#pragma warning disable CS0612
            Operation <Empty, OperationMetadata> retrievedResponse = await serviceUsageClient.PollOnceEnableServiceAsync(operationName);

#pragma warning restore CS0612
            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }