-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support multiple parent patterns for controls
docs: mention multiple parent patterns for controls PiperOrigin-RevId: 638017343 Source-Link: googleapis/googleapis@dd6a42d Source-Link: googleapis/googleapis-gen@553fe9e Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuRGlzY292ZXJ5RW5naW5lLlYxLy5Pd2xCb3QueWFtbCIsImgiOiI1NTNmZTllNzRmYTYxYzQ3NWNkNjI1NDRiMjgzZTcwNzk1ZTg3NmNiIn0=
- Loading branch information
1 parent
50fe0e3
commit c8f3726
Showing
21 changed files
with
940 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ne.V1.GeneratedSnippets/ControlServiceClient.CreateControlResourceNames1AsyncSnippet.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Generated code. DO NOT EDIT! | ||
|
||
namespace GoogleCSharpSnippets | ||
{ | ||
// [START discoveryengine_v1_generated_ControlService_CreateControl_async_flattened_resourceNames1] | ||
using Google.Cloud.DiscoveryEngine.V1; | ||
using System.Threading.Tasks; | ||
|
||
public sealed partial class GeneratedControlServiceClientSnippets | ||
{ | ||
/// <summary>Snippet for CreateControlAsync</summary> | ||
/// <remarks> | ||
/// This snippet has been automatically generated and should be regarded as a code template only. | ||
/// It will require modifications to work: | ||
/// - It may require correct/in-range values for request initialization. | ||
/// - It may require specifying regional endpoints when creating the service client as shown in | ||
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint. | ||
/// </remarks> | ||
public async Task CreateControlResourceNames1Async() | ||
{ | ||
// Create client | ||
ControlServiceClient controlServiceClient = await ControlServiceClient.CreateAsync(); | ||
// Initialize request argument(s) | ||
EngineName parent = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]"); | ||
Control control = new Control(); | ||
string controlId = ""; | ||
// Make the request | ||
Control response = await controlServiceClient.CreateControlAsync(parent, control, controlId); | ||
} | ||
} | ||
// [END discoveryengine_v1_generated_ControlService_CreateControl_async_flattened_resourceNames1] | ||
} |
45 changes: 45 additions & 0 deletions
45
...yEngine.V1.GeneratedSnippets/ControlServiceClient.CreateControlResourceNames1Snippet.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Generated code. DO NOT EDIT! | ||
|
||
namespace GoogleCSharpSnippets | ||
{ | ||
// [START discoveryengine_v1_generated_ControlService_CreateControl_sync_flattened_resourceNames1] | ||
using Google.Cloud.DiscoveryEngine.V1; | ||
|
||
public sealed partial class GeneratedControlServiceClientSnippets | ||
{ | ||
/// <summary>Snippet for CreateControl</summary> | ||
/// <remarks> | ||
/// This snippet has been automatically generated and should be regarded as a code template only. | ||
/// It will require modifications to work: | ||
/// - It may require correct/in-range values for request initialization. | ||
/// - It may require specifying regional endpoints when creating the service client as shown in | ||
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint. | ||
/// </remarks> | ||
public void CreateControlResourceNames1() | ||
{ | ||
// Create client | ||
ControlServiceClient controlServiceClient = ControlServiceClient.Create(); | ||
// Initialize request argument(s) | ||
EngineName parent = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]"); | ||
Control control = new Control(); | ||
string controlId = ""; | ||
// Make the request | ||
Control response = controlServiceClient.CreateControl(parent, control, controlId); | ||
} | ||
} | ||
// [END discoveryengine_v1_generated_ControlService_CreateControl_sync_flattened_resourceNames1] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...ine.V1.GeneratedSnippets/ControlServiceClient.ListControlsResourceNames1AsyncSnippet.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Generated code. DO NOT EDIT! | ||
|
||
namespace GoogleCSharpSnippets | ||
{ | ||
// [START discoveryengine_v1_generated_ControlService_ListControls_async_flattened_resourceNames1] | ||
using Google.Api.Gax; | ||
using Google.Cloud.DiscoveryEngine.V1; | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
public sealed partial class GeneratedControlServiceClientSnippets | ||
{ | ||
/// <summary>Snippet for ListControlsAsync</summary> | ||
/// <remarks> | ||
/// This snippet has been automatically generated and should be regarded as a code template only. | ||
/// It will require modifications to work: | ||
/// - It may require correct/in-range values for request initialization. | ||
/// - It may require specifying regional endpoints when creating the service client as shown in | ||
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint. | ||
/// </remarks> | ||
public async Task ListControlsResourceNames1Async() | ||
{ | ||
// Create client | ||
ControlServiceClient controlServiceClient = await ControlServiceClient.CreateAsync(); | ||
// Initialize request argument(s) | ||
EngineName parent = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]"); | ||
// Make the request | ||
PagedAsyncEnumerable<ListControlsResponse, Control> response = controlServiceClient.ListControlsAsync(parent); | ||
|
||
// Iterate over all response items, lazily performing RPCs as required | ||
await response.ForEachAsync((Control 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((ListControlsResponse page) => | ||
{ | ||
// Do something with each page of items | ||
Console.WriteLine("A page of results:"); | ||
foreach (Control 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<Control> 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 (Control 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 discoveryengine_v1_generated_ControlService_ListControls_async_flattened_resourceNames1] | ||
} |
77 changes: 77 additions & 0 deletions
77
...ryEngine.V1.GeneratedSnippets/ControlServiceClient.ListControlsResourceNames1Snippet.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Generated code. DO NOT EDIT! | ||
|
||
namespace GoogleCSharpSnippets | ||
{ | ||
// [START discoveryengine_v1_generated_ControlService_ListControls_sync_flattened_resourceNames1] | ||
using Google.Api.Gax; | ||
using Google.Cloud.DiscoveryEngine.V1; | ||
using System; | ||
|
||
public sealed partial class GeneratedControlServiceClientSnippets | ||
{ | ||
/// <summary>Snippet for ListControls</summary> | ||
/// <remarks> | ||
/// This snippet has been automatically generated and should be regarded as a code template only. | ||
/// It will require modifications to work: | ||
/// - It may require correct/in-range values for request initialization. | ||
/// - It may require specifying regional endpoints when creating the service client as shown in | ||
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint. | ||
/// </remarks> | ||
public void ListControlsResourceNames1() | ||
{ | ||
// Create client | ||
ControlServiceClient controlServiceClient = ControlServiceClient.Create(); | ||
// Initialize request argument(s) | ||
EngineName parent = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]"); | ||
// Make the request | ||
PagedEnumerable<ListControlsResponse, Control> response = controlServiceClient.ListControls(parent); | ||
|
||
// Iterate over all response items, lazily performing RPCs as required | ||
foreach (Control item in response) | ||
{ | ||
// Do something with each item | ||
Console.WriteLine(item); | ||
} | ||
|
||
// Or iterate over pages (of server-defined size), performing one RPC per page | ||
foreach (ListControlsResponse page in response.AsRawResponses()) | ||
{ | ||
// Do something with each page of items | ||
Console.WriteLine("A page of results:"); | ||
foreach (Control 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<Control> singlePage = response.ReadPage(pageSize); | ||
// Do something with the page of items | ||
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); | ||
foreach (Control 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 discoveryengine_v1_generated_ControlService_ListControls_sync_flattened_resourceNames1] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.