-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: protos for R/W transaction support on multiplexed sessions
PiperOrigin-RevId: 683879049 Source-Link: googleapis/googleapis@2b6b93b Source-Link: googleapis/googleapis-gen@2f0c933 Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuU3Bhbm5lci5WMS8uT3dsQm90LnlhbWwiLCJoIjoiMmYwYzkzM2IwMDMxNjRkNWNkMTIwNTA1YTk4Yzg3Yzk1ODg4ZDk4ZiJ9
- Loading branch information
1 parent
df83180
commit 550d06e
Showing
86 changed files
with
34,296 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...oogle.Cloud.Spanner.V1.GeneratedSnippets/Google.Cloud.Spanner.V1.GeneratedSnippets.csproj
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net462</TargetFrameworks> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="../Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1.csproj" /> | ||
<PackageReference Include="System.Linq.Async" Version="6.0.1" /> | ||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
</Project> |
45 changes: 45 additions & 0 deletions
45
...gle.Cloud.Spanner.V1.GeneratedSnippets/SpannerClient.BatchCreateSessionsAsyncSnippet.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 spanner_v1_generated_Spanner_BatchCreateSessions_async_flattened] | ||
using Google.Cloud.Spanner.V1; | ||
using System.Threading.Tasks; | ||
|
||
public sealed partial class GeneratedSpannerClientSnippets | ||
{ | ||
/// <summary>Snippet for BatchCreateSessionsAsync</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 BatchCreateSessionsAsync() | ||
{ | ||
// Create client | ||
SpannerClient spannerClient = await SpannerClient.CreateAsync(); | ||
// Initialize request argument(s) | ||
string database = "projects/[PROJECT]/instances/[INSTANCE]/databases/[DATABASE]"; | ||
int sessionCount = 0; | ||
// Make the request | ||
BatchCreateSessionsResponse response = await spannerClient.BatchCreateSessionsAsync(database, sessionCount); | ||
} | ||
} | ||
// [END spanner_v1_generated_Spanner_BatchCreateSessions_async_flattened] | ||
} |
49 changes: 49 additions & 0 deletions
49
...nner.V1.GeneratedSnippets/SpannerClient.BatchCreateSessionsRequestObjectAsyncSnippet.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,49 @@ | ||
// 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 spanner_v1_generated_Spanner_BatchCreateSessions_async] | ||
using Google.Cloud.Spanner.V1; | ||
using System.Threading.Tasks; | ||
|
||
public sealed partial class GeneratedSpannerClientSnippets | ||
{ | ||
/// <summary>Snippet for BatchCreateSessionsAsync</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 BatchCreateSessionsRequestObjectAsync() | ||
{ | ||
// Create client | ||
SpannerClient spannerClient = await SpannerClient.CreateAsync(); | ||
// Initialize request argument(s) | ||
BatchCreateSessionsRequest request = new BatchCreateSessionsRequest | ||
{ | ||
DatabaseAsDatabaseName = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]"), | ||
SessionTemplate = new Session(), | ||
SessionCount = 0, | ||
}; | ||
// Make the request | ||
BatchCreateSessionsResponse response = await spannerClient.BatchCreateSessionsAsync(request); | ||
} | ||
} | ||
// [END spanner_v1_generated_Spanner_BatchCreateSessions_async] | ||
} |
48 changes: 48 additions & 0 deletions
48
...d.Spanner.V1.GeneratedSnippets/SpannerClient.BatchCreateSessionsRequestObjectSnippet.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,48 @@ | ||
// 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 spanner_v1_generated_Spanner_BatchCreateSessions_sync] | ||
using Google.Cloud.Spanner.V1; | ||
|
||
public sealed partial class GeneratedSpannerClientSnippets | ||
{ | ||
/// <summary>Snippet for BatchCreateSessions</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 BatchCreateSessionsRequestObject() | ||
{ | ||
// Create client | ||
SpannerClient spannerClient = SpannerClient.Create(); | ||
// Initialize request argument(s) | ||
BatchCreateSessionsRequest request = new BatchCreateSessionsRequest | ||
{ | ||
DatabaseAsDatabaseName = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]"), | ||
SessionTemplate = new Session(), | ||
SessionCount = 0, | ||
}; | ||
// Make the request | ||
BatchCreateSessionsResponse response = spannerClient.BatchCreateSessions(request); | ||
} | ||
} | ||
// [END spanner_v1_generated_Spanner_BatchCreateSessions_sync] | ||
} |
45 changes: 45 additions & 0 deletions
45
...nner.V1.GeneratedSnippets/SpannerClient.BatchCreateSessionsResourceNamesAsyncSnippet.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 spanner_v1_generated_Spanner_BatchCreateSessions_async_flattened_resourceNames] | ||
using Google.Cloud.Spanner.V1; | ||
using System.Threading.Tasks; | ||
|
||
public sealed partial class GeneratedSpannerClientSnippets | ||
{ | ||
/// <summary>Snippet for BatchCreateSessionsAsync</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 BatchCreateSessionsResourceNamesAsync() | ||
{ | ||
// Create client | ||
SpannerClient spannerClient = await SpannerClient.CreateAsync(); | ||
// Initialize request argument(s) | ||
DatabaseName database = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]"); | ||
int sessionCount = 0; | ||
// Make the request | ||
BatchCreateSessionsResponse response = await spannerClient.BatchCreateSessionsAsync(database, sessionCount); | ||
} | ||
} | ||
// [END spanner_v1_generated_Spanner_BatchCreateSessions_async_flattened_resourceNames] | ||
} |
44 changes: 44 additions & 0 deletions
44
...d.Spanner.V1.GeneratedSnippets/SpannerClient.BatchCreateSessionsResourceNamesSnippet.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,44 @@ | ||
// 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 spanner_v1_generated_Spanner_BatchCreateSessions_sync_flattened_resourceNames] | ||
using Google.Cloud.Spanner.V1; | ||
|
||
public sealed partial class GeneratedSpannerClientSnippets | ||
{ | ||
/// <summary>Snippet for BatchCreateSessions</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 BatchCreateSessionsResourceNames() | ||
{ | ||
// Create client | ||
SpannerClient spannerClient = SpannerClient.Create(); | ||
// Initialize request argument(s) | ||
DatabaseName database = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]"); | ||
int sessionCount = 0; | ||
// Make the request | ||
BatchCreateSessionsResponse response = spannerClient.BatchCreateSessions(database, sessionCount); | ||
} | ||
} | ||
// [END spanner_v1_generated_Spanner_BatchCreateSessions_sync_flattened_resourceNames] | ||
} |
44 changes: 44 additions & 0 deletions
44
...1/Google.Cloud.Spanner.V1.GeneratedSnippets/SpannerClient.BatchCreateSessionsSnippet.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,44 @@ | ||
// 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 spanner_v1_generated_Spanner_BatchCreateSessions_sync_flattened] | ||
using Google.Cloud.Spanner.V1; | ||
|
||
public sealed partial class GeneratedSpannerClientSnippets | ||
{ | ||
/// <summary>Snippet for BatchCreateSessions</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 BatchCreateSessions() | ||
{ | ||
// Create client | ||
SpannerClient spannerClient = SpannerClient.Create(); | ||
// Initialize request argument(s) | ||
string database = "projects/[PROJECT]/instances/[INSTANCE]/databases/[DATABASE]"; | ||
int sessionCount = 0; | ||
// Make the request | ||
BatchCreateSessionsResponse response = spannerClient.BatchCreateSessions(database, sessionCount); | ||
} | ||
} | ||
// [END spanner_v1_generated_Spanner_BatchCreateSessions_sync_flattened] | ||
} |
64 changes: 64 additions & 0 deletions
64
...ogle.Cloud.Spanner.V1.GeneratedSnippets/SpannerClient.BatchWriteRequestObjectSnippet.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,64 @@ | ||
// 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 spanner_v1_generated_Spanner_BatchWrite_sync] | ||
using Google.Api.Gax.Grpc; | ||
using Google.Cloud.Spanner.V1; | ||
using System.Threading.Tasks; | ||
|
||
public sealed partial class GeneratedSpannerClientSnippets | ||
{ | ||
/// <summary>Snippet for BatchWrite</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 BatchWriteRequestObject() | ||
{ | ||
// Create client | ||
SpannerClient spannerClient = SpannerClient.Create(); | ||
// Initialize request argument(s) | ||
BatchWriteRequest request = new BatchWriteRequest | ||
{ | ||
SessionAsSessionName = SessionName.FromProjectInstanceDatabaseSession("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), | ||
RequestOptions = new RequestOptions(), | ||
MutationGroups = | ||
{ | ||
new BatchWriteRequest.Types.MutationGroup(), | ||
}, | ||
ExcludeTxnFromChangeStreams = false, | ||
}; | ||
// Make the request, returning a streaming response | ||
using SpannerClient.BatchWriteStream response = spannerClient.BatchWrite(request); | ||
|
||
// Read streaming responses from server until complete | ||
// Note that C# 8 code can use await foreach | ||
AsyncResponseStream<BatchWriteResponse> responseStream = response.GetResponseStream(); | ||
while (await responseStream.MoveNextAsync()) | ||
{ | ||
BatchWriteResponse responseItem = responseStream.Current; | ||
// Do something with streamed response | ||
} | ||
// The response stream has completed | ||
} | ||
} | ||
// [END spanner_v1_generated_Spanner_BatchWrite_sync] | ||
} |
Oops, something went wrong.