/// <summary>Snippet for DisableService</summary>
        public void DisableServiceRequestObject()
        {
            // Snippet: DisableService(DisableServiceRequest, CallSettings)
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            DisableServiceRequest request = new DisableServiceRequest
            {
                Name = "",
                DisableDependentServices = false,
                CheckIfServiceHasUsage   = DisableServiceRequest.Types.CheckIfServiceHasUsage.Unspecified,
            };
            // Make the request
            Operation <DisableServiceResponse, OperationMetadata> response = serviceUsageClient.DisableService(request);

            // Poll until the returned long-running operation is complete
            Operation <DisableServiceResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = serviceUsageClient.PollOnceDisableService(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;
            }
            // End snippet
        }
        /// <summary>Snippet for DisableService</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DisableServiceRequestObject()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            DisableServiceRequest request = new DisableServiceRequest {
                Name = "",
            };

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

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = serviceUsageClient.PollOnceDisableService(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;
            }
        }
        /// <summary>Snippet for BatchEnableServices</summary>
        public void BatchEnableServicesRequestObject()
        {
            // Snippet: BatchEnableServices(BatchEnableServicesRequest, CallSettings)
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            BatchEnableServicesRequest request = new BatchEnableServicesRequest
            {
                Parent     = "",
                ServiceIds = { "", },
            };
            // Make the request
            Operation <BatchEnableServicesResponse, OperationMetadata> response = serviceUsageClient.BatchEnableServices(request);

            // Poll until the returned long-running operation is complete
            Operation <BatchEnableServicesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = serviceUsageClient.PollOnceBatchEnableServices(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;
            }
            // End snippet
        }
        /// <summary>Snippet for GenerateServiceIdentity</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void GenerateServiceIdentityRequestObject()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            GenerateServiceIdentityRequest request = new GenerateServiceIdentityRequest {
                Parent = "",
            };
            // Make the request
            Operation <ServiceIdentity, Empty> response = serviceUsageClient.GenerateServiceIdentity(request);

            // Poll until the returned long-running operation is complete
            Operation <ServiceIdentity, Empty> completedResponse = response.PollUntilCompleted();
            // 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 = serviceUsageClient.PollOnceGenerateServiceIdentity(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;
            }
        }
        /// <summary>Snippet for DeleteConsumerOverride</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteConsumerOverrideRequestObject()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            DeleteConsumerOverrideRequest request = new DeleteConsumerOverrideRequest
            {
                Name      = "",
                Force     = false,
                ForceOnly =
                {
                    QuotaSafetyCheck.Unspecified,
                },
            };
            // Make the request
            Operation <Empty, OperationMetadata> response = serviceUsageClient.DeleteConsumerOverride(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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, OperationMetadata> retrievedResponse = serviceUsageClient.PollOnceDeleteConsumerOverride(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;
            }
        }
        /// <summary>Snippet for ImportAdminOverrides</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ImportAdminOverridesRequestObject()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            ImportAdminOverridesRequest request = new ImportAdminOverridesRequest
            {
                Parent       = "",
                InlineSource = new OverrideInlineSource(),
                Force        = false,
                ForceOnly    =
                {
                    QuotaSafetyCheck.Unspecified,
                },
            };
            // Make the request
            Operation <ImportAdminOverridesResponse, ImportAdminOverridesMetadata> response = serviceUsageClient.ImportAdminOverrides(request);

            // Poll until the returned long-running operation is complete
            Operation <ImportAdminOverridesResponse, ImportAdminOverridesMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = serviceUsageClient.PollOnceImportAdminOverrides(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;
            }
        }
 /// <summary>Snippet for GetService</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetServiceRequestObject()
 {
     // Create client
     ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
     // Initialize request argument(s)
     GetServiceRequest request = new GetServiceRequest {
         Name = "",
     };
     // Make the request
     Service response = serviceUsageClient.GetService(request);
 }
 /// <summary>Snippet for GetService</summary>
 public void GetServiceRequestObject()
 {
     // Snippet: GetService(GetServiceRequest, CallSettings)
     // Create client
     ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
     // Initialize request argument(s)
     GetServiceRequest request = new GetServiceRequest {
         Name = "",
     };
     // Make the request
     Service response = serviceUsageClient.GetService(request);
     // End snippet
 }
Esempio n. 9
0
 /// <summary>Snippet for GetConsumerQuotaMetric</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetConsumerQuotaMetricRequestObject()
 {
     // Create client
     ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
     // Initialize request argument(s)
     GetConsumerQuotaMetricRequest request = new GetConsumerQuotaMetricRequest
     {
         Name = "",
         View = QuotaView.Unspecified,
     };
     // Make the request
     ConsumerQuotaMetric response = serviceUsageClient.GetConsumerQuotaMetric(request);
 }
Esempio n. 10
0
 /// <summary>Snippet for BatchGetServices</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void BatchGetServicesRequestObject()
 {
     // Create client
     ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
     // Initialize request argument(s)
     BatchGetServicesRequest request = new BatchGetServicesRequest
     {
         Parent = "",
         Names  = { "", },
     };
     // Make the request
     BatchGetServicesResponse response = serviceUsageClient.BatchGetServices(request);
 }
        /// <summary>Snippet for GetService</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void GetServiceRequestObject()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            GetServiceRequest request = new GetServiceRequest {
                Name = "",
            };

            // Make the request
#pragma warning disable CS0612
            Service response = serviceUsageClient.GetService(request);
#pragma warning restore CS0612
        }
        /// <summary>Snippet for ListServices</summary>
        public void ListServicesRequestObject()
        {
            // Snippet: ListServices(ListServicesRequest, CallSettings)
            // Create client
            ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
            // Initialize request argument(s)
            ListServicesRequest request = new ListServicesRequest
            {
                Parent = "",
                Filter = "",
            };
            // Make the request
            PagedEnumerable <ListServicesResponse, Service> response = serviceUsageClient.ListServices(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Service 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 (ListServicesResponse page in response.AsRawResponses())
            {
                // 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 = response.ReadPage(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;
            // End snippet
        }