Exemple #1
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
        }
 /// <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
 }