Skip to content

Commit 887dc16

Browse files
gcf-owl-bot[bot]jskeet
authored andcommitted
feat: Adds support for cancel Execution
feat: Adds support for Execution overrides feat: Adds support for Direct VPC egress setting feat: New fields for multi-container feat: New field for Task's scheduled timestamp docs: General documentation fixes. PiperOrigin-RevId: 567710896 Source-Link: googleapis/googleapis@c5985fe Source-Link: googleapis/googleapis-gen@0e5c6ac Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuUnVuLlYyLy5Pd2xCb3QueWFtbCIsImgiOiIwZTVjNmFjN2YzNTliYTE3NzY2MzRlMzZjM2MxNzRlZTcyYTA3ZWFjIn0=
1 parent 03d3e9c commit 887dc16

23 files changed

+3203
-327
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
#pragma warning disable CS8981
18+
19+
namespace GoogleCSharpSnippets
20+
{
21+
// [START run_v2_generated_Executions_CancelExecution_async_flattened]
22+
using Google.LongRunning;
23+
using System.Threading.Tasks;
24+
using gcrv = Google.Cloud.Run.V2;
25+
26+
public sealed partial class GeneratedExecutionsClientSnippets
27+
{
28+
/// <summary>Snippet for CancelExecutionAsync</summary>
29+
/// <remarks>
30+
/// This snippet has been automatically generated and should be regarded as a code template only.
31+
/// It will require modifications to work:
32+
/// - It may require correct/in-range values for request initialization.
33+
/// - It may require specifying regional endpoints when creating the service client as shown in
34+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
35+
/// </remarks>
36+
public async Task CancelExecutionAsync()
37+
{
38+
// Create client
39+
gcrv::ExecutionsClient executionsClient = await gcrv::ExecutionsClient.CreateAsync();
40+
// Initialize request argument(s)
41+
string name = "projects/[PROJECT]/locations/[LOCATION]/jobs/[JOB]/executions/[EXECUTION]";
42+
// Make the request
43+
Operation<gcrv::Execution, gcrv::Execution> response = await executionsClient.CancelExecutionAsync(name);
44+
45+
// Poll until the returned long-running operation is complete
46+
Operation<gcrv::Execution, gcrv::Execution> completedResponse = await response.PollUntilCompletedAsync();
47+
// Retrieve the operation result
48+
gcrv::Execution result = completedResponse.Result;
49+
50+
// Or get the name of the operation
51+
string operationName = response.Name;
52+
// This name can be stored, then the long-running operation retrieved later by name
53+
Operation<gcrv::Execution, gcrv::Execution> retrievedResponse = await executionsClient.PollOnceCancelExecutionAsync(operationName);
54+
// Check if the retrieved long-running operation has completed
55+
if (retrievedResponse.IsCompleted)
56+
{
57+
// If it has completed, then access the result
58+
gcrv::Execution retrievedResult = retrievedResponse.Result;
59+
}
60+
}
61+
}
62+
// [END run_v2_generated_Executions_CancelExecution_async_flattened]
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
#pragma warning disable CS8981
18+
19+
namespace GoogleCSharpSnippets
20+
{
21+
// [START run_v2_generated_Executions_CancelExecution_async]
22+
using Google.LongRunning;
23+
using System.Threading.Tasks;
24+
using gcrv = Google.Cloud.Run.V2;
25+
26+
public sealed partial class GeneratedExecutionsClientSnippets
27+
{
28+
/// <summary>Snippet for CancelExecutionAsync</summary>
29+
/// <remarks>
30+
/// This snippet has been automatically generated and should be regarded as a code template only.
31+
/// It will require modifications to work:
32+
/// - It may require correct/in-range values for request initialization.
33+
/// - It may require specifying regional endpoints when creating the service client as shown in
34+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
35+
/// </remarks>
36+
public async Task CancelExecutionRequestObjectAsync()
37+
{
38+
// Create client
39+
gcrv::ExecutionsClient executionsClient = await gcrv::ExecutionsClient.CreateAsync();
40+
// Initialize request argument(s)
41+
gcrv::CancelExecutionRequest request = new gcrv::CancelExecutionRequest
42+
{
43+
ExecutionName = gcrv::ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"),
44+
ValidateOnly = false,
45+
Etag = "",
46+
};
47+
// Make the request
48+
Operation<gcrv::Execution, gcrv::Execution> response = await executionsClient.CancelExecutionAsync(request);
49+
50+
// Poll until the returned long-running operation is complete
51+
Operation<gcrv::Execution, gcrv::Execution> completedResponse = await response.PollUntilCompletedAsync();
52+
// Retrieve the operation result
53+
gcrv::Execution result = completedResponse.Result;
54+
55+
// Or get the name of the operation
56+
string operationName = response.Name;
57+
// This name can be stored, then the long-running operation retrieved later by name
58+
Operation<gcrv::Execution, gcrv::Execution> retrievedResponse = await executionsClient.PollOnceCancelExecutionAsync(operationName);
59+
// Check if the retrieved long-running operation has completed
60+
if (retrievedResponse.IsCompleted)
61+
{
62+
// If it has completed, then access the result
63+
gcrv::Execution retrievedResult = retrievedResponse.Result;
64+
}
65+
}
66+
}
67+
// [END run_v2_generated_Executions_CancelExecution_async]
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START run_v2_generated_Executions_CancelExecution_sync]
20+
using Google.Cloud.Run.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedExecutionsClientSnippets
24+
{
25+
/// <summary>Snippet for CancelExecution</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated and should be regarded as a code template only.
28+
/// It will require modifications to work:
29+
/// - It may require correct/in-range values for request initialization.
30+
/// - It may require specifying regional endpoints when creating the service client as shown in
31+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
32+
/// </remarks>
33+
public void CancelExecutionRequestObject()
34+
{
35+
// Create client
36+
ExecutionsClient executionsClient = ExecutionsClient.Create();
37+
// Initialize request argument(s)
38+
CancelExecutionRequest request = new CancelExecutionRequest
39+
{
40+
ExecutionName = ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"),
41+
ValidateOnly = false,
42+
Etag = "",
43+
};
44+
// Make the request
45+
Operation<Execution, Execution> response = executionsClient.CancelExecution(request);
46+
47+
// Poll until the returned long-running operation is complete
48+
Operation<Execution, Execution> completedResponse = response.PollUntilCompleted();
49+
// Retrieve the operation result
50+
Execution result = completedResponse.Result;
51+
52+
// Or get the name of the operation
53+
string operationName = response.Name;
54+
// This name can be stored, then the long-running operation retrieved later by name
55+
Operation<Execution, Execution> retrievedResponse = executionsClient.PollOnceCancelExecution(operationName);
56+
// Check if the retrieved long-running operation has completed
57+
if (retrievedResponse.IsCompleted)
58+
{
59+
// If it has completed, then access the result
60+
Execution retrievedResult = retrievedResponse.Result;
61+
}
62+
}
63+
}
64+
// [END run_v2_generated_Executions_CancelExecution_sync]
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
#pragma warning disable CS8981
18+
19+
namespace GoogleCSharpSnippets
20+
{
21+
// [START run_v2_generated_Executions_CancelExecution_async_flattened_resourceNames]
22+
using Google.LongRunning;
23+
using System.Threading.Tasks;
24+
using gcrv = Google.Cloud.Run.V2;
25+
26+
public sealed partial class GeneratedExecutionsClientSnippets
27+
{
28+
/// <summary>Snippet for CancelExecutionAsync</summary>
29+
/// <remarks>
30+
/// This snippet has been automatically generated and should be regarded as a code template only.
31+
/// It will require modifications to work:
32+
/// - It may require correct/in-range values for request initialization.
33+
/// - It may require specifying regional endpoints when creating the service client as shown in
34+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
35+
/// </remarks>
36+
public async Task CancelExecutionResourceNamesAsync()
37+
{
38+
// Create client
39+
gcrv::ExecutionsClient executionsClient = await gcrv::ExecutionsClient.CreateAsync();
40+
// Initialize request argument(s)
41+
gcrv::ExecutionName name = gcrv::ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
42+
// Make the request
43+
Operation<gcrv::Execution, gcrv::Execution> response = await executionsClient.CancelExecutionAsync(name);
44+
45+
// Poll until the returned long-running operation is complete
46+
Operation<gcrv::Execution, gcrv::Execution> completedResponse = await response.PollUntilCompletedAsync();
47+
// Retrieve the operation result
48+
gcrv::Execution result = completedResponse.Result;
49+
50+
// Or get the name of the operation
51+
string operationName = response.Name;
52+
// This name can be stored, then the long-running operation retrieved later by name
53+
Operation<gcrv::Execution, gcrv::Execution> retrievedResponse = await executionsClient.PollOnceCancelExecutionAsync(operationName);
54+
// Check if the retrieved long-running operation has completed
55+
if (retrievedResponse.IsCompleted)
56+
{
57+
// If it has completed, then access the result
58+
gcrv::Execution retrievedResult = retrievedResponse.Result;
59+
}
60+
}
61+
}
62+
// [END run_v2_generated_Executions_CancelExecution_async_flattened_resourceNames]
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START run_v2_generated_Executions_CancelExecution_sync_flattened_resourceNames]
20+
using Google.Cloud.Run.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedExecutionsClientSnippets
24+
{
25+
/// <summary>Snippet for CancelExecution</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated and should be regarded as a code template only.
28+
/// It will require modifications to work:
29+
/// - It may require correct/in-range values for request initialization.
30+
/// - It may require specifying regional endpoints when creating the service client as shown in
31+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
32+
/// </remarks>
33+
public void CancelExecutionResourceNames()
34+
{
35+
// Create client
36+
ExecutionsClient executionsClient = ExecutionsClient.Create();
37+
// Initialize request argument(s)
38+
ExecutionName name = ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
39+
// Make the request
40+
Operation<Execution, Execution> response = executionsClient.CancelExecution(name);
41+
42+
// Poll until the returned long-running operation is complete
43+
Operation<Execution, Execution> completedResponse = response.PollUntilCompleted();
44+
// Retrieve the operation result
45+
Execution result = completedResponse.Result;
46+
47+
// Or get the name of the operation
48+
string operationName = response.Name;
49+
// This name can be stored, then the long-running operation retrieved later by name
50+
Operation<Execution, Execution> retrievedResponse = executionsClient.PollOnceCancelExecution(operationName);
51+
// Check if the retrieved long-running operation has completed
52+
if (retrievedResponse.IsCompleted)
53+
{
54+
// If it has completed, then access the result
55+
Execution retrievedResult = retrievedResponse.Result;
56+
}
57+
}
58+
}
59+
// [END run_v2_generated_Executions_CancelExecution_sync_flattened_resourceNames]
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START run_v2_generated_Executions_CancelExecution_sync_flattened]
20+
using Google.Cloud.Run.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedExecutionsClientSnippets
24+
{
25+
/// <summary>Snippet for CancelExecution</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated and should be regarded as a code template only.
28+
/// It will require modifications to work:
29+
/// - It may require correct/in-range values for request initialization.
30+
/// - It may require specifying regional endpoints when creating the service client as shown in
31+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
32+
/// </remarks>
33+
public void CancelExecution()
34+
{
35+
// Create client
36+
ExecutionsClient executionsClient = ExecutionsClient.Create();
37+
// Initialize request argument(s)
38+
string name = "projects/[PROJECT]/locations/[LOCATION]/jobs/[JOB]/executions/[EXECUTION]";
39+
// Make the request
40+
Operation<Execution, Execution> response = executionsClient.CancelExecution(name);
41+
42+
// Poll until the returned long-running operation is complete
43+
Operation<Execution, Execution> completedResponse = response.PollUntilCompleted();
44+
// Retrieve the operation result
45+
Execution result = completedResponse.Result;
46+
47+
// Or get the name of the operation
48+
string operationName = response.Name;
49+
// This name can be stored, then the long-running operation retrieved later by name
50+
Operation<Execution, Execution> retrievedResponse = executionsClient.PollOnceCancelExecution(operationName);
51+
// Check if the retrieved long-running operation has completed
52+
if (retrievedResponse.IsCompleted)
53+
{
54+
// If it has completed, then access the result
55+
Execution retrievedResult = retrievedResponse.Result;
56+
}
57+
}
58+
}
59+
// [END run_v2_generated_Executions_CancelExecution_sync_flattened]
60+
}

apis/Google.Cloud.Run.V2/Google.Cloud.Run.V2.GeneratedSnippets/JobsClient.RunJobRequestObjectAsyncSnippet.g.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public async Task RunJobRequestObjectAsync()
4343
JobName = gcrv::JobName.FromProjectLocationJob("[PROJECT]", "[LOCATION]", "[JOB]"),
4444
ValidateOnly = false,
4545
Etag = "",
46+
Overrides = new gcrv::RunJobRequest.Types.Overrides(),
4647
};
4748
// Make the request
4849
Operation<gcrv::Execution, gcrv::Execution> response = await jobsClient.RunJobAsync(request);

0 commit comments

Comments
 (0)