Exemplo n.º 1
0
        /// <summary>Snippet for DeleteEnvironment</summary>
        public void DeleteEnvironment()
        {
            // Snippet: DeleteEnvironment(string, CallSettings)
            // Create client
            EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
            // Initialize request argument(s)
            string name = "";
            // Make the request
            Operation <Empty, OperationMetadata> response = environmentsClient.DeleteEnvironment(name);

            // 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 = environmentsClient.PollOnceDeleteEnvironment(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
        }
Exemplo n.º 2
0
        /// <summary>Snippet for CreateEnvironment</summary>
        public void CreateEnvironmentRequestObject()
        {
            // Snippet: CreateEnvironment(CreateEnvironmentRequest, CallSettings)
            // Create client
            EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
            // Initialize request argument(s)
            CreateEnvironmentRequest request = new CreateEnvironmentRequest
            {
                Parent      = "",
                Environment = new gcoasv::Environment(),
            };
            // Make the request
            Operation <gcoasv::Environment, OperationMetadata> response = environmentsClient.CreateEnvironment(request);

            // Poll until the returned long-running operation is complete
            Operation <gcoasv::Environment, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            gcoasv::Environment 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 <gcoasv::Environment, OperationMetadata> retrievedResponse = environmentsClient.PollOnceCreateEnvironment(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcoasv::Environment retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Exemplo n.º 3
0
        /// <summary>Snippet for UpdateEnvironment</summary>
        public void UpdateEnvironment()
        {
            // Snippet: UpdateEnvironment(string, Environment, FieldMask, CallSettings)
            // Create client
            EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
            // Initialize request argument(s)
            string name = "";
            gcoasv::Environment environment = new gcoasv::Environment();
            FieldMask           updateMask  = new FieldMask();
            // Make the request
            Operation <gcoasv::Environment, OperationMetadata> response = environmentsClient.UpdateEnvironment(name, environment, updateMask);

            // Poll until the returned long-running operation is complete
            Operation <gcoasv::Environment, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            gcoasv::Environment 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 <gcoasv::Environment, OperationMetadata> retrievedResponse = environmentsClient.PollOnceUpdateEnvironment(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcoasv::Environment retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Exemplo n.º 4
0
 /// <summary>Snippet for GetEnvironment</summary>
 public void GetEnvironment()
 {
     // Snippet: GetEnvironment(string, CallSettings)
     // Create client
     EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
     // Initialize request argument(s)
     string name = "";
     // Make the request
     gcoasv::Environment response = environmentsClient.GetEnvironment(name);
     // End snippet
 }
Exemplo n.º 5
0
 /// <summary>Snippet for GetEnvironment</summary>
 public void GetEnvironmentRequestObject()
 {
     // Snippet: GetEnvironment(GetEnvironmentRequest, CallSettings)
     // Create client
     EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
     // Initialize request argument(s)
     GetEnvironmentRequest request = new GetEnvironmentRequest {
         Name = "",
     };
     // Make the request
     gcoasv::Environment response = environmentsClient.GetEnvironment(request);
     // End snippet
 }
 /// <summary>Snippet for GetEnvironment</summary>
 public void GetEnvironmentRequestObject()
 {
     // Snippet: GetEnvironment(GetEnvironmentRequest, CallSettings)
     // Create client
     EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
     // Initialize request argument(s)
     GetEnvironmentRequest request = new GetEnvironmentRequest
     {
         EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
     };
     // Make the request
     gcdv::Environment response = environmentsClient.GetEnvironment(request);
     // End snippet
 }
        /// <summary>Snippet for DeleteEnvironment</summary>
        public void DeleteEnvironmentRequestObject()
        {
            // Snippet: DeleteEnvironment(DeleteEnvironmentRequest, CallSettings)
            // Create client
            EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
            // Initialize request argument(s)
            DeleteEnvironmentRequest request = new DeleteEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
            };

            // Make the request
            environmentsClient.DeleteEnvironment(request);
            // End snippet
        }
 /// <summary>Snippet for UpdateEnvironment</summary>
 public void UpdateEnvironmentRequestObject()
 {
     // Snippet: UpdateEnvironment(UpdateEnvironmentRequest, CallSettings)
     // Create client
     EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
     // Initialize request argument(s)
     UpdateEnvironmentRequest request = new UpdateEnvironmentRequest
     {
         Environment = new gcdv::Environment(),
         UpdateMask  = new FieldMask(),
         AllowLoadToDraftAndDiscardChanges = false,
     };
     // Make the request
     gcdv::Environment response = environmentsClient.UpdateEnvironment(request);
     // End snippet
 }
 /// <summary>Snippet for CreateEnvironment</summary>
 public void CreateEnvironmentRequestObject()
 {
     // Snippet: CreateEnvironment(CreateEnvironmentRequest, CallSettings)
     // Create client
     EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
     // Initialize request argument(s)
     CreateEnvironmentRequest request = new CreateEnvironmentRequest
     {
         ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
         Environment       = new gcdv::Environment(),
         EnvironmentId     = "",
     };
     // Make the request
     gcdv::Environment response = environmentsClient.CreateEnvironment(request);
     // End snippet
 }
        /// <summary>Snippet for ListEnvironments</summary>
        public void ListEnvironmentsRequestObject()
        {
            // Snippet: ListEnvironments(ListEnvironmentsRequest, CallSettings)
            // Create client
            EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
            // Initialize request argument(s)
            ListEnvironmentsRequest request = new ListEnvironmentsRequest
            {
                ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
            };
            // Make the request
            PagedEnumerable <ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironments(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (gcdv::Environment 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 (ListEnvironmentsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (gcdv::Environment 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 <gcdv::Environment> 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 (gcdv::Environment 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
        }