/// <summary>Snippet for StageBuildAsync</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 StageBuildResourceNamesAsync() { // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) BuildArtifactName name = BuildArtifactName.FromBuildTargetModelBuildArtifact("[BUILD_TARGET]", "[MODEL]", "[BUILD]", "[ARTIFACT]"); // Make the request Operation <StageBuildResponse, StageBuildMetadata> response = await buildServiceClient.StageBuildAsync(name); // 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; } }
/// <summary>Snippet for StageBuildAsync</summary> public async Task StageBuildAsync() { // Snippet: StageBuildAsync(string, CallSettings) // Additional: StageBuildAsync(string, CancellationToken) // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) string name = "buildTargets/[BUILD_TARGET]/models/[MODEL]/builds/[BUILD]/artifacts/[ARTIFACT]"; // Make the request Operation <StageBuildResponse, StageBuildMetadata> response = await buildServiceClient.StageBuildAsync(name); // 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 }
/// <summary>Snippet for CheckBuildStageStatusAsync</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 CheckBuildStageStatusAsync() { // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) string name = "buildTargets/[BUILD_TARGET]/models/[MODEL]/builds/[BUILD]/artifacts/[ARTIFACT]"; // Make the request CheckBuildStageStatusResponse response = await buildServiceClient.CheckBuildStageStatusAsync(name); }
/// <summary>Snippet for CheckBuildStageStatusAsync</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 CheckBuildStageStatusResourceNamesAsync() { // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) BuildArtifactName name = BuildArtifactName.FromBuildTargetModelBuildArtifact("[BUILD_TARGET]", "[MODEL]", "[BUILD]", "[ARTIFACT]"); // Make the request CheckBuildStageStatusResponse response = await buildServiceClient.CheckBuildStageStatusAsync(name); }
/// <summary>Snippet for ListBuildsAsync</summary> public async Task ListBuildsRequestObjectAsync() { // Snippet: ListBuildsAsync(ListBuildsRequest, CallSettings) // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) ListBuildsRequest request = new ListBuildsRequest { ParentAsModelName = ModelName.FromBuildTargetModel("[BUILD_TARGET]", "[MODEL]"), Filter = "", ReadMask = new FieldMask(), GroupBy = new FieldMask(), }; // Make the request PagedAsyncEnumerable <ListBuildsResponse, Build> response = buildServiceClient.ListBuildsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Build 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((ListBuildsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Build 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 <Build> 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 (Build 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 CheckBuildStageStatusAsync</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 CheckBuildStageStatusRequestObjectAsync() { // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) CheckBuildStageStatusRequest request = new CheckBuildStageStatusRequest { BuildArtifactName = BuildArtifactName.FromBuildTargetModelBuildArtifact("[BUILD_TARGET]", "[MODEL]", "[BUILD]", "[ARTIFACT]"), Filter = "", }; // Make the request CheckBuildStageStatusResponse response = await buildServiceClient.CheckBuildStageStatusAsync(request); }
/// <summary>Snippet for CheckBuildStageStatusAsync</summary> public async Task CheckBuildStageStatusResourceNamesAsync() { // Snippet: CheckBuildStageStatusAsync(BuildArtifactName, CallSettings) // Additional: CheckBuildStageStatusAsync(BuildArtifactName, CancellationToken) // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) BuildArtifactName name = BuildArtifactName.FromBuildTargetModelBuildArtifact("[BUILD_TARGET]", "[MODEL]", "[BUILD]", "[ARTIFACT]"); // Make the request CheckBuildStageStatusResponse response = await buildServiceClient.CheckBuildStageStatusAsync(name); // End snippet }
/// <summary>Snippet for CheckBuildStageStatusAsync</summary> public async Task CheckBuildStageStatusAsync() { // Snippet: CheckBuildStageStatusAsync(string, CallSettings) // Additional: CheckBuildStageStatusAsync(string, CancellationToken) // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) string name = "buildTargets/[BUILD_TARGET]/models/[MODEL]/builds/[BUILD]/artifacts/[ARTIFACT]"; // Make the request CheckBuildStageStatusResponse response = await buildServiceClient.CheckBuildStageStatusAsync(name); // End snippet }
/// <summary>Snippet for CheckBuildStageStatusAsync</summary> public async Task CheckBuildStageStatusRequestObjectAsync() { // Snippet: CheckBuildStageStatusAsync(CheckBuildStageStatusRequest, CallSettings) // Additional: CheckBuildStageStatusAsync(CheckBuildStageStatusRequest, CancellationToken) // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) CheckBuildStageStatusRequest request = new CheckBuildStageStatusRequest { BuildArtifactName = BuildArtifactName.FromBuildTargetModelBuildArtifact("[BUILD_TARGET]", "[MODEL]", "[BUILD]", "[ARTIFACT]"), Filter = "", }; // Make the request CheckBuildStageStatusResponse response = await buildServiceClient.CheckBuildStageStatusAsync(request); // End snippet }
/// <summary>Snippet for ListBuildsAsync</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 ListBuildsAsync() { // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "buildTargets/[BUILD_TARGET]/models/[MODEL]"; // Make the request PagedAsyncEnumerable <ListBuildsResponse, Build> response = buildServiceClient.ListBuildsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Build 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((ListBuildsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Build 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 <Build> 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 (Build 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; }