Skip to content

Commit 85bc403

Browse files
gcf-owl-bot[bot]jskeet
authored andcommitted
feat: Adds Cloud Run Jobs v2 API client libraries
A Cloud Run Job runs its tasks and exits when finished. For more information about Cloud Run Jobs, visit https://cloud.google.com/run/docs/create-jobs PiperOrigin-RevId: 485653075 Source-Link: googleapis/googleapis@a9a137b Source-Link: googleapis/googleapis-gen@7d398ce Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuUnVuLlYyLy5Pd2xCb3QueWFtbCIsImgiOiI3ZDM5OGNlNjhhZDAxMDFkYjYwMTMwZDUyNjk1MGRmMGVmY2FkZGNlIn0=
1 parent 3f73874 commit 85bc403

126 files changed

Lines changed: 24517 additions & 85 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2022 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 Google.Cloud.Run.V2.Snippets
20+
{
21+
// [START run_v2_generated_Executions_DeleteExecution_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 DeleteExecutionAsync</summary>
29+
/// <remarks>
30+
/// This snippet has been automatically generated for illustrative purposes only.
31+
/// It may require modifications to work in your environment.
32+
/// </remarks>
33+
public async Task DeleteExecutionAsync()
34+
{
35+
// Create client
36+
ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();
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 = await executionsClient.DeleteExecutionAsync(name);
41+
42+
// Poll until the returned long-running operation is complete
43+
Operation<Execution, Execution> completedResponse = await response.PollUntilCompletedAsync();
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 = await executionsClient.PollOnceDeleteExecutionAsync(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_DeleteExecution_async_flattened]
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2022 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 Google.Cloud.Run.V2.Snippets
20+
{
21+
// [START run_v2_generated_Executions_DeleteExecution_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 DeleteExecutionAsync</summary>
29+
/// <remarks>
30+
/// This snippet has been automatically generated for illustrative purposes only.
31+
/// It may require modifications to work in your environment.
32+
/// </remarks>
33+
public async Task DeleteExecutionRequestObjectAsync()
34+
{
35+
// Create client
36+
ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();
37+
// Initialize request argument(s)
38+
DeleteExecutionRequest request = new DeleteExecutionRequest
39+
{
40+
ExecutionName = ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"),
41+
ValidateOnly = false,
42+
Etag = "",
43+
};
44+
// Make the request
45+
Operation<Execution, Execution> response = await executionsClient.DeleteExecutionAsync(request);
46+
47+
// Poll until the returned long-running operation is complete
48+
Operation<Execution, Execution> completedResponse = await response.PollUntilCompletedAsync();
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 = await executionsClient.PollOnceDeleteExecutionAsync(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_DeleteExecution_async]
65+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2022 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 Google.Cloud.Run.V2.Snippets
18+
{
19+
// [START run_v2_generated_Executions_DeleteExecution_sync]
20+
using Google.Cloud.Run.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedExecutionsClientSnippets
24+
{
25+
/// <summary>Snippet for DeleteExecution</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated for illustrative purposes only.
28+
/// It may require modifications to work in your environment.
29+
/// </remarks>
30+
public void DeleteExecutionRequestObject()
31+
{
32+
// Create client
33+
ExecutionsClient executionsClient = ExecutionsClient.Create();
34+
// Initialize request argument(s)
35+
DeleteExecutionRequest request = new DeleteExecutionRequest
36+
{
37+
ExecutionName = ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"),
38+
ValidateOnly = false,
39+
Etag = "",
40+
};
41+
// Make the request
42+
Operation<Execution, Execution> response = executionsClient.DeleteExecution(request);
43+
44+
// Poll until the returned long-running operation is complete
45+
Operation<Execution, Execution> completedResponse = response.PollUntilCompleted();
46+
// Retrieve the operation result
47+
Execution result = completedResponse.Result;
48+
49+
// Or get the name of the operation
50+
string operationName = response.Name;
51+
// This name can be stored, then the long-running operation retrieved later by name
52+
Operation<Execution, Execution> retrievedResponse = executionsClient.PollOnceDeleteExecution(operationName);
53+
// Check if the retrieved long-running operation has completed
54+
if (retrievedResponse.IsCompleted)
55+
{
56+
// If it has completed, then access the result
57+
Execution retrievedResult = retrievedResponse.Result;
58+
}
59+
}
60+
}
61+
// [END run_v2_generated_Executions_DeleteExecution_sync]
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2022 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 Google.Cloud.Run.V2.Snippets
20+
{
21+
// [START run_v2_generated_Executions_DeleteExecution_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 DeleteExecutionAsync</summary>
29+
/// <remarks>
30+
/// This snippet has been automatically generated for illustrative purposes only.
31+
/// It may require modifications to work in your environment.
32+
/// </remarks>
33+
public async Task DeleteExecutionResourceNamesAsync()
34+
{
35+
// Create client
36+
ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();
37+
// Initialize request argument(s)
38+
ExecutionName name = ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
39+
// Make the request
40+
Operation<Execution, Execution> response = await executionsClient.DeleteExecutionAsync(name);
41+
42+
// Poll until the returned long-running operation is complete
43+
Operation<Execution, Execution> completedResponse = await response.PollUntilCompletedAsync();
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 = await executionsClient.PollOnceDeleteExecutionAsync(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_DeleteExecution_async_flattened_resourceNames]
60+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright 2022 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 Google.Cloud.Run.V2.Snippets
18+
{
19+
// [START run_v2_generated_Executions_DeleteExecution_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 DeleteExecution</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated for illustrative purposes only.
28+
/// It may require modifications to work in your environment.
29+
/// </remarks>
30+
public void DeleteExecutionResourceNames()
31+
{
32+
// Create client
33+
ExecutionsClient executionsClient = ExecutionsClient.Create();
34+
// Initialize request argument(s)
35+
ExecutionName name = ExecutionName.FromProjectLocationJobExecution("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
36+
// Make the request
37+
Operation<Execution, Execution> response = executionsClient.DeleteExecution(name);
38+
39+
// Poll until the returned long-running operation is complete
40+
Operation<Execution, Execution> completedResponse = response.PollUntilCompleted();
41+
// Retrieve the operation result
42+
Execution result = completedResponse.Result;
43+
44+
// Or get the name of the operation
45+
string operationName = response.Name;
46+
// This name can be stored, then the long-running operation retrieved later by name
47+
Operation<Execution, Execution> retrievedResponse = executionsClient.PollOnceDeleteExecution(operationName);
48+
// Check if the retrieved long-running operation has completed
49+
if (retrievedResponse.IsCompleted)
50+
{
51+
// If it has completed, then access the result
52+
Execution retrievedResult = retrievedResponse.Result;
53+
}
54+
}
55+
}
56+
// [END run_v2_generated_Executions_DeleteExecution_sync_flattened_resourceNames]
57+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright 2022 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 Google.Cloud.Run.V2.Snippets
18+
{
19+
// [START run_v2_generated_Executions_DeleteExecution_sync_flattened]
20+
using Google.Cloud.Run.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedExecutionsClientSnippets
24+
{
25+
/// <summary>Snippet for DeleteExecution</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated for illustrative purposes only.
28+
/// It may require modifications to work in your environment.
29+
/// </remarks>
30+
public void DeleteExecution()
31+
{
32+
// Create client
33+
ExecutionsClient executionsClient = ExecutionsClient.Create();
34+
// Initialize request argument(s)
35+
string name = "projects/[PROJECT]/locations/[LOCATION]/jobs/[JOB]/executions/[EXECUTION]";
36+
// Make the request
37+
Operation<Execution, Execution> response = executionsClient.DeleteExecution(name);
38+
39+
// Poll until the returned long-running operation is complete
40+
Operation<Execution, Execution> completedResponse = response.PollUntilCompleted();
41+
// Retrieve the operation result
42+
Execution result = completedResponse.Result;
43+
44+
// Or get the name of the operation
45+
string operationName = response.Name;
46+
// This name can be stored, then the long-running operation retrieved later by name
47+
Operation<Execution, Execution> retrievedResponse = executionsClient.PollOnceDeleteExecution(operationName);
48+
// Check if the retrieved long-running operation has completed
49+
if (retrievedResponse.IsCompleted)
50+
{
51+
// If it has completed, then access the result
52+
Execution retrievedResult = retrievedResponse.Result;
53+
}
54+
}
55+
}
56+
// [END run_v2_generated_Executions_DeleteExecution_sync_flattened]
57+
}

0 commit comments

Comments
 (0)