"gcp resource managment c#" Code Answer's

You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "gcp resource managment c#" answered properly. Developers are finding an appropriate answer about gcp resource managment c# related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like gcp resource managment c#. Enter your desired code related query in the search bar and get every piece of information about C# code related question on gcp resource managment c#. 

gcp resource managment c#

By Real RayReal Ray on Dec 04, 2020
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

using Google.Apis.Auth.OAuth2;
using Google.Apis.CloudResourceManager.v1;
using Google.Apis.Services;

using Data = Google.Apis.CloudResourceManager.v1.Data;

namespace OurFirstProject
{
    public class Program
    {
        private const string projectId = [YOUR-PROJECT-ID];
        private const string applicationName = "Test";

        public static void Main(string[] args)
        {

            var scopes = new String[] {
                CloudResourceManagerService.Scope.CloudPlatform
            };

            GoogleCredential credential = Task.Run(
                () => GoogleCredential.GetApplicationDefaultAsync()
            ).Result;

            if (credential.IsCreateScopedRequired)
            {
                credential = credential.CreateScoped(scopes);
            }

            CloudResourceManagerService service = new CloudResourceManagerService(
                new BaseClientService.Initializer()
                {
                    HttpClientInitializer = credential,
                    ApplicationName = applicationName
                }
            );

            Console.WriteLine("1. Create Project");
            Data.Operation operation1 = service.Projects.Create(
                new Data.Project()
                {
                    ProjectId = projectId,
                }
            ).Execute();

            Console.Write("2. Awaiting Operation Completion");
            Data.Operation operation2;
            do
            {
                operation2 = service.Operations.Get(operation1.Name).Execute();
                Console.WriteLine(operation2.Done.ToString());
                System.Threading.Thread.Sleep(1000);
            } while (operation2.Done != true);

            Console.WriteLine();
            Console.WriteLine("Enter to continue");
            Console.ReadLine();

            Console.WriteLine("3. Deleting Project");
            var operation3 = service.Projects.Delete(projectId).Execute();
        }
    }
}

Source: sodocumentation.net

Add Comment

0

All those coders who are working on the C# based application and are stuck on gcp resource managment c# can get a collection of related answers to their query. Programmers need to enter their query on gcp resource managment c# related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about gcp resource managment c# for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of gcp resource managment c# while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "gcp resource managment c#". Visit this developer's friendly online web community, CodeProZone, and get your queries like gcp resource managment c# resolved professionally and stay updated to the latest C# updates. 

C# answers related to "gcp resource managment c#"

View All C# queries

C# queries related to "gcp resource managment c#"

Browse Other Code Languages

CodeProZone