Exemple #1
0
 /// <summary>Snippet for GetBillingAccount</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetBillingAccountResourceNames()
 {
     // Create client
     CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
     // Initialize request argument(s)
     BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
     // Make the request
     BillingAccount response = cloudBillingClient.GetBillingAccount(name);
 }
 /// <summary>Snippet for CreateBudget</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CreateBudgetResourceNames()
 {
     // Create client
     BudgetServiceClient budgetServiceClient = BudgetServiceClient.Create();
     // Initialize request argument(s)
     BillingAccountName parent = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
     Budget             budget = new Budget();
     // Make the request
     Budget response = budgetServiceClient.CreateBudget(parent, budget);
 }
        /// <summary>Snippet for GetBillingAccountAsync</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 GetBillingAccountResourceNamesAsync()
        {
            // Create client
            CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();

            // Initialize request argument(s)
            BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
            // Make the request
            BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(name);
        }
Exemple #4
0
 /// <summary>Snippet for GetBillingAccount</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetBillingAccountRequestObject()
 {
     // Create client
     CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
     // Initialize request argument(s)
     GetBillingAccountRequest request = new GetBillingAccountRequest
     {
         BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
     };
     // Make the request
     BillingAccount response = cloudBillingClient.GetBillingAccount(request);
 }
 /// <summary>Snippet for CreateBudget</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CreateBudgetRequestObject()
 {
     // Create client
     BudgetServiceClient budgetServiceClient = BudgetServiceClient.Create();
     // Initialize request argument(s)
     CreateBudgetRequest request = new CreateBudgetRequest
     {
         ParentAsBillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
         Budget = new Budget(),
     };
     // Make the request
     Budget response = budgetServiceClient.CreateBudget(request);
 }
Exemple #6
0
        /// <summary>Snippet for GetBillingAccountAsync</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 GetBillingAccountRequestObjectAsync()
        {
            // Create client
            CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();

            // Initialize request argument(s)
            GetBillingAccountRequest request = new GetBillingAccountRequest
            {
                BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
            };
            // Make the request
            BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(request);
        }
 /// <summary>Snippet for UpdateBillingAccount</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void UpdateBillingAccountRequestObject()
 {
     // Create client
     CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
     // Initialize request argument(s)
     UpdateBillingAccountRequest request = new UpdateBillingAccountRequest
     {
         BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
         Account            = new BillingAccount(),
         UpdateMask         = new FieldMask(),
     };
     // Make the request
     BillingAccount response = cloudBillingClient.UpdateBillingAccount(request);
 }
        /// <summary>Snippet for CreateBudgetAsync</summary>
        public async Task CreateBudgetResourceNamesAsync()
        {
            // Snippet: CreateBudgetAsync(BillingAccountName, Budget, CallSettings)
            // Additional: CreateBudgetAsync(BillingAccountName, Budget, CancellationToken)
            // Create client
            BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            BillingAccountName parent = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
            Budget             budget = new Budget();
            // Make the request
            Budget response = await budgetServiceClient.CreateBudgetAsync(parent, budget);

            // End snippet
        }
        /// <summary>Snippet for ListBudgetsAsync</summary>
        public async Task ListBudgetsRequestObjectAsync()
        {
            // Snippet: ListBudgetsAsync(ListBudgetsRequest, CallSettings)
            // Create client
            BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListBudgetsRequest request = new ListBudgetsRequest
            {
                ParentAsBillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListBudgetsResponse, Budget> response = budgetServiceClient.ListBudgetsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Budget 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((ListBudgetsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Budget 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 <Budget> 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 (Budget 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
        }
        /// <summary>Snippet for ListProjectBillingInfo</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListProjectBillingInfoRequestObject()
        {
            // Create client
            CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
            // Initialize request argument(s)
            ListProjectBillingInfoRequest request = new ListProjectBillingInfoRequest
            {
                BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
            };
            // Make the request
            PagedEnumerable <ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfo(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (ProjectBillingInfo 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 (ListProjectBillingInfoResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ProjectBillingInfo 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 <ProjectBillingInfo> 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 (ProjectBillingInfo 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 CreateBudgetAsync</summary>
        public async Task CreateBudgetRequestObjectAsync()
        {
            // Snippet: CreateBudgetAsync(CreateBudgetRequest, CallSettings)
            // Additional: CreateBudgetAsync(CreateBudgetRequest, CancellationToken)
            // Create client
            BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateBudgetRequest request = new CreateBudgetRequest
            {
                ParentAsBillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
                Budget = new Budget(),
            };
            // Make the request
            Budget response = await budgetServiceClient.CreateBudgetAsync(request);

            // End snippet
        }
        /// <summary>Snippet for ListBudgets</summary>
        public void ListBudgetsResourceNames()
        {
            // Snippet: ListBudgets(BillingAccountName, string, int?, CallSettings)
            // Create client
            BudgetServiceClient budgetServiceClient = BudgetServiceClient.Create();
            // Initialize request argument(s)
            BillingAccountName parent = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
            // Make the request
            PagedEnumerable <ListBudgetsResponse, Budget> response = budgetServiceClient.ListBudgets(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Budget 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 (ListBudgetsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Budget 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 <Budget> 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 (Budget 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
        }
        /// <summary>Snippet for ListProjectBillingInfoAsync</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 ListProjectBillingInfoResourceNamesAsync()
        {
            // Create client
            CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();

            // Initialize request argument(s)
            BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
            // Make the request
            PagedAsyncEnumerable <ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfoAsync(name);

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