Skip to content

Commit

Permalink
feat: add RESOURCE_EXHAUSTED to the list of retryable error codes
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 628281023

Source-Link: googleapis/googleapis@60536a2

Source-Link: googleapis/googleapis-gen@c5cfd5b
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuU3Bhbm5lci5WMS8uT3dsQm90LnlhbWwiLCJoIjoiYzVjZmQ1Yjk1NmY5ZWFkZmY1NDA5NmM5ZjFjOGE1N2FiMDFkYjI5NCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Apr 26, 2024
1 parent b44f916 commit 6534cd2
Show file tree
Hide file tree
Showing 86 changed files with 33,316 additions and 0 deletions.
@@ -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>
@@ -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]
}
@@ -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]
}
@@ -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]
}
@@ -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]
}
@@ -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]
}
@@ -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]
}
@@ -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]
}

0 comments on commit 6534cd2

Please sign in to comment.