コード例 #1
0
        /// <summary>Snippet for StageBuild</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void StageBuildRequestObject()
        {
            // Create client
            BuildServiceClient buildServiceClient = BuildServiceClient.Create();
            // Initialize request argument(s)
            StageBuildRequest request = new StageBuildRequest
            {
                BuildArtifactName = BuildArtifactName.FromBuildTargetModelBuildArtifact("[BUILD_TARGET]", "[MODEL]", "[BUILD]", "[ARTIFACT]"),
                Filter            = "",
            };
            // Make the request
            Operation <StageBuildResponse, StageBuildMetadata> response = buildServiceClient.StageBuild(request);

            // Poll until the returned long-running operation is complete
            Operation <StageBuildResponse, StageBuildMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            StageBuildResponse 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 <StageBuildResponse, StageBuildMetadata> retrievedResponse = buildServiceClient.PollOnceStageBuild(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                StageBuildResponse retrievedResult = retrievedResponse.Result;
            }
        }
コード例 #2
0
        /// <summary>Snippet for StageBuildAsync</summary>
        public async Task StageBuildRequestObjectAsync()
        {
            // Snippet: StageBuildAsync(StageBuildRequest, CallSettings)
            // Additional: StageBuildAsync(StageBuildRequest, CancellationToken)
            // Create client
            BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync();

            // Initialize request argument(s)
            StageBuildRequest request = new StageBuildRequest
            {
                BuildArtifactName = BuildArtifactName.FromBuildTargetModelBuildArtifact("[BUILD_TARGET]", "[MODEL]", "[BUILD]", "[ARTIFACT]"),
                Filter            = "",
            };
            // Make the request
            Operation <StageBuildResponse, StageBuildMetadata> response = await buildServiceClient.StageBuildAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <StageBuildResponse, StageBuildMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            StageBuildResponse 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 <StageBuildResponse, StageBuildMetadata> retrievedResponse = await buildServiceClient.PollOnceStageBuildAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                StageBuildResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }