Skip to content

Commit 4d3c458

Browse files
gcf-owl-bot[bot]amanda-tarafa
authored andcommitted
feat: added support for deploy policies
docs: Minor documentation updates PiperOrigin-RevId: 679600689 Source-Link: googleapis/googleapis@bd4f368 Source-Link: googleapis/googleapis-gen@12a2d22 Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuRGVwbG95LlYxLy5Pd2xCb3QueWFtbCIsImgiOiIxMmEyZDIyYmYxYmRhODViYTliZWQxZmE2MDQ4NDMwNmEyZTU1NzgxIn0=
1 parent 001c246 commit 4d3c458

56 files changed

Lines changed: 15644 additions & 3305 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.

apis/Google.Cloud.Deploy.V1/Google.Cloud.Deploy.V1.GeneratedSnippets/CloudDeployClient.AdvanceRolloutRequestObjectAsyncSnippet.g.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public async Task AdvanceRolloutRequestObjectAsync()
3939
{
4040
RolloutName = RolloutName.FromProjectLocationDeliveryPipelineReleaseRollout("[PROJECT]", "[LOCATION]", "[DELIVERY_PIPELINE]", "[RELEASE]", "[ROLLOUT]"),
4141
PhaseId = "",
42+
OverrideDeployPolicyAsDeployPolicyNames =
43+
{
44+
DeployPolicyName.FromProjectLocationDeployPolicy("[PROJECT]", "[LOCATION]", "[DEPLOY_POLICY]"),
45+
},
4246
};
4347
// Make the request
4448
AdvanceRolloutResponse response = await cloudDeployClient.AdvanceRolloutAsync(request);

apis/Google.Cloud.Deploy.V1/Google.Cloud.Deploy.V1.GeneratedSnippets/CloudDeployClient.AdvanceRolloutRequestObjectSnippet.g.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public void AdvanceRolloutRequestObject()
3838
{
3939
RolloutName = RolloutName.FromProjectLocationDeliveryPipelineReleaseRollout("[PROJECT]", "[LOCATION]", "[DELIVERY_PIPELINE]", "[RELEASE]", "[ROLLOUT]"),
4040
PhaseId = "",
41+
OverrideDeployPolicyAsDeployPolicyNames =
42+
{
43+
DeployPolicyName.FromProjectLocationDeployPolicy("[PROJECT]", "[LOCATION]", "[DEPLOY_POLICY]"),
44+
},
4145
};
4246
// Make the request
4347
AdvanceRolloutResponse response = cloudDeployClient.AdvanceRollout(request);

apis/Google.Cloud.Deploy.V1/Google.Cloud.Deploy.V1.GeneratedSnippets/CloudDeployClient.ApproveRolloutRequestObjectAsyncSnippet.g.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public async Task ApproveRolloutRequestObjectAsync()
3939
{
4040
RolloutName = RolloutName.FromProjectLocationDeliveryPipelineReleaseRollout("[PROJECT]", "[LOCATION]", "[DELIVERY_PIPELINE]", "[RELEASE]", "[ROLLOUT]"),
4141
Approved = false,
42+
OverrideDeployPolicyAsDeployPolicyNames =
43+
{
44+
DeployPolicyName.FromProjectLocationDeployPolicy("[PROJECT]", "[LOCATION]", "[DEPLOY_POLICY]"),
45+
},
4246
};
4347
// Make the request
4448
ApproveRolloutResponse response = await cloudDeployClient.ApproveRolloutAsync(request);

apis/Google.Cloud.Deploy.V1/Google.Cloud.Deploy.V1.GeneratedSnippets/CloudDeployClient.ApproveRolloutRequestObjectSnippet.g.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public void ApproveRolloutRequestObject()
3838
{
3939
RolloutName = RolloutName.FromProjectLocationDeliveryPipelineReleaseRollout("[PROJECT]", "[LOCATION]", "[DELIVERY_PIPELINE]", "[RELEASE]", "[ROLLOUT]"),
4040
Approved = false,
41+
OverrideDeployPolicyAsDeployPolicyNames =
42+
{
43+
DeployPolicyName.FromProjectLocationDeployPolicy("[PROJECT]", "[LOCATION]", "[DEPLOY_POLICY]"),
44+
},
4145
};
4246
// Make the request
4347
ApproveRolloutResponse response = cloudDeployClient.ApproveRollout(request);

apis/Google.Cloud.Deploy.V1/Google.Cloud.Deploy.V1.GeneratedSnippets/CloudDeployClient.CancelRolloutRequestObjectAsyncSnippet.g.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public async Task CancelRolloutRequestObjectAsync()
3838
CancelRolloutRequest request = new CancelRolloutRequest
3939
{
4040
RolloutName = RolloutName.FromProjectLocationDeliveryPipelineReleaseRollout("[PROJECT]", "[LOCATION]", "[DELIVERY_PIPELINE]", "[RELEASE]", "[ROLLOUT]"),
41+
OverrideDeployPolicyAsDeployPolicyNames =
42+
{
43+
DeployPolicyName.FromProjectLocationDeployPolicy("[PROJECT]", "[LOCATION]", "[DEPLOY_POLICY]"),
44+
},
4145
};
4246
// Make the request
4347
CancelRolloutResponse response = await cloudDeployClient.CancelRolloutAsync(request);

apis/Google.Cloud.Deploy.V1/Google.Cloud.Deploy.V1.GeneratedSnippets/CloudDeployClient.CancelRolloutRequestObjectSnippet.g.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public void CancelRolloutRequestObject()
3737
CancelRolloutRequest request = new CancelRolloutRequest
3838
{
3939
RolloutName = RolloutName.FromProjectLocationDeliveryPipelineReleaseRollout("[PROJECT]", "[LOCATION]", "[DELIVERY_PIPELINE]", "[RELEASE]", "[ROLLOUT]"),
40+
OverrideDeployPolicyAsDeployPolicyNames =
41+
{
42+
DeployPolicyName.FromProjectLocationDeployPolicy("[PROJECT]", "[LOCATION]", "[DEPLOY_POLICY]"),
43+
},
4044
};
4145
// Make the request
4246
CancelRolloutResponse response = cloudDeployClient.CancelRollout(request);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2024 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 clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_async_flattened]
20+
using Google.Cloud.Deploy.V1;
21+
using Google.LongRunning;
22+
using System.Threading.Tasks;
23+
24+
public sealed partial class GeneratedCloudDeployClientSnippets
25+
{
26+
/// <summary>Snippet for CreateDeployPolicyAsync</summary>
27+
/// <remarks>
28+
/// This snippet has been automatically generated and should be regarded as a code template only.
29+
/// It will require modifications to work:
30+
/// - It may require correct/in-range values for request initialization.
31+
/// - It may require specifying regional endpoints when creating the service client as shown in
32+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
33+
/// </remarks>
34+
public async Task CreateDeployPolicyAsync()
35+
{
36+
// Create client
37+
CloudDeployClient cloudDeployClient = await CloudDeployClient.CreateAsync();
38+
// Initialize request argument(s)
39+
string parent = "projects/[PROJECT]/locations/[LOCATION]";
40+
DeployPolicy deployPolicy = new DeployPolicy();
41+
string deployPolicyId = "";
42+
// Make the request
43+
Operation<DeployPolicy, OperationMetadata> response = await cloudDeployClient.CreateDeployPolicyAsync(parent, deployPolicy, deployPolicyId);
44+
45+
// Poll until the returned long-running operation is complete
46+
Operation<DeployPolicy, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
47+
// Retrieve the operation result
48+
DeployPolicy 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<DeployPolicy, OperationMetadata> retrievedResponse = await cloudDeployClient.PollOnceCreateDeployPolicyAsync(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+
DeployPolicy retrievedResult = retrievedResponse.Result;
59+
}
60+
}
61+
}
62+
// [END clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_async_flattened]
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Copyright 2024 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 clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_async]
20+
using Google.Api.Gax.ResourceNames;
21+
using Google.Cloud.Deploy.V1;
22+
using Google.LongRunning;
23+
using System.Threading.Tasks;
24+
25+
public sealed partial class GeneratedCloudDeployClientSnippets
26+
{
27+
/// <summary>Snippet for CreateDeployPolicyAsync</summary>
28+
/// <remarks>
29+
/// This snippet has been automatically generated and should be regarded as a code template only.
30+
/// It will require modifications to work:
31+
/// - It may require correct/in-range values for request initialization.
32+
/// - It may require specifying regional endpoints when creating the service client as shown in
33+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
34+
/// </remarks>
35+
public async Task CreateDeployPolicyRequestObjectAsync()
36+
{
37+
// Create client
38+
CloudDeployClient cloudDeployClient = await CloudDeployClient.CreateAsync();
39+
// Initialize request argument(s)
40+
CreateDeployPolicyRequest request = new CreateDeployPolicyRequest
41+
{
42+
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
43+
DeployPolicyId = "",
44+
DeployPolicy = new DeployPolicy(),
45+
RequestId = "",
46+
ValidateOnly = false,
47+
};
48+
// Make the request
49+
Operation<DeployPolicy, OperationMetadata> response = await cloudDeployClient.CreateDeployPolicyAsync(request);
50+
51+
// Poll until the returned long-running operation is complete
52+
Operation<DeployPolicy, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
53+
// Retrieve the operation result
54+
DeployPolicy result = completedResponse.Result;
55+
56+
// Or get the name of the operation
57+
string operationName = response.Name;
58+
// This name can be stored, then the long-running operation retrieved later by name
59+
Operation<DeployPolicy, OperationMetadata> retrievedResponse = await cloudDeployClient.PollOnceCreateDeployPolicyAsync(operationName);
60+
// Check if the retrieved long-running operation has completed
61+
if (retrievedResponse.IsCompleted)
62+
{
63+
// If it has completed, then access the result
64+
DeployPolicy retrievedResult = retrievedResponse.Result;
65+
}
66+
}
67+
}
68+
// [END clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_async]
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 2024 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 clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_sync]
20+
using Google.Api.Gax.ResourceNames;
21+
using Google.Cloud.Deploy.V1;
22+
using Google.LongRunning;
23+
24+
public sealed partial class GeneratedCloudDeployClientSnippets
25+
{
26+
/// <summary>Snippet for CreateDeployPolicy</summary>
27+
/// <remarks>
28+
/// This snippet has been automatically generated and should be regarded as a code template only.
29+
/// It will require modifications to work:
30+
/// - It may require correct/in-range values for request initialization.
31+
/// - It may require specifying regional endpoints when creating the service client as shown in
32+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
33+
/// </remarks>
34+
public void CreateDeployPolicyRequestObject()
35+
{
36+
// Create client
37+
CloudDeployClient cloudDeployClient = CloudDeployClient.Create();
38+
// Initialize request argument(s)
39+
CreateDeployPolicyRequest request = new CreateDeployPolicyRequest
40+
{
41+
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
42+
DeployPolicyId = "",
43+
DeployPolicy = new DeployPolicy(),
44+
RequestId = "",
45+
ValidateOnly = false,
46+
};
47+
// Make the request
48+
Operation<DeployPolicy, OperationMetadata> response = cloudDeployClient.CreateDeployPolicy(request);
49+
50+
// Poll until the returned long-running operation is complete
51+
Operation<DeployPolicy, OperationMetadata> completedResponse = response.PollUntilCompleted();
52+
// Retrieve the operation result
53+
DeployPolicy 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<DeployPolicy, OperationMetadata> retrievedResponse = cloudDeployClient.PollOnceCreateDeployPolicy(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+
DeployPolicy retrievedResult = retrievedResponse.Result;
64+
}
65+
}
66+
}
67+
// [END clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_sync]
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright 2024 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 clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_async_flattened_resourceNames]
20+
using Google.Api.Gax.ResourceNames;
21+
using Google.Cloud.Deploy.V1;
22+
using Google.LongRunning;
23+
using System.Threading.Tasks;
24+
25+
public sealed partial class GeneratedCloudDeployClientSnippets
26+
{
27+
/// <summary>Snippet for CreateDeployPolicyAsync</summary>
28+
/// <remarks>
29+
/// This snippet has been automatically generated and should be regarded as a code template only.
30+
/// It will require modifications to work:
31+
/// - It may require correct/in-range values for request initialization.
32+
/// - It may require specifying regional endpoints when creating the service client as shown in
33+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
34+
/// </remarks>
35+
public async Task CreateDeployPolicyResourceNamesAsync()
36+
{
37+
// Create client
38+
CloudDeployClient cloudDeployClient = await CloudDeployClient.CreateAsync();
39+
// Initialize request argument(s)
40+
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
41+
DeployPolicy deployPolicy = new DeployPolicy();
42+
string deployPolicyId = "";
43+
// Make the request
44+
Operation<DeployPolicy, OperationMetadata> response = await cloudDeployClient.CreateDeployPolicyAsync(parent, deployPolicy, deployPolicyId);
45+
46+
// Poll until the returned long-running operation is complete
47+
Operation<DeployPolicy, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
48+
// Retrieve the operation result
49+
DeployPolicy result = completedResponse.Result;
50+
51+
// Or get the name of the operation
52+
string operationName = response.Name;
53+
// This name can be stored, then the long-running operation retrieved later by name
54+
Operation<DeployPolicy, OperationMetadata> retrievedResponse = await cloudDeployClient.PollOnceCreateDeployPolicyAsync(operationName);
55+
// Check if the retrieved long-running operation has completed
56+
if (retrievedResponse.IsCompleted)
57+
{
58+
// If it has completed, then access the result
59+
DeployPolicy retrievedResult = retrievedResponse.Result;
60+
}
61+
}
62+
}
63+
// [END clouddeploy_v1_generated_CloudDeploy_CreateDeployPolicy_async_flattened_resourceNames]
64+
}

0 commit comments

Comments
 (0)