/
LocationsClient.g.cs
373 lines (324 loc) · 19.9 KB
/
LocationsClient.g.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
// 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!
#pragma warning disable CS8981
using gax = Google.Api.Gax;
using gaxgrpc = Google.Api.Gax.Grpc;
using proto = Google.Protobuf;
using grpccore = Grpc.Core;
using grpcinter = Grpc.Core.Interceptors;
using mel = Microsoft.Extensions.Logging;
using sys = System;
using sc = System.Collections;
using scg = System.Collections.Generic;
using sco = System.Collections.ObjectModel;
using st = System.Threading;
using stt = System.Threading.Tasks;
namespace Google.Cloud.Location
{
/// <summary>Settings for <see cref="LocationsClient"/> instances.</summary>
public sealed partial class LocationsSettings : gaxgrpc::ServiceSettingsBase
{
/// <summary>Get a new instance of the default <see cref="LocationsSettings"/>.</summary>
/// <returns>A new instance of the default <see cref="LocationsSettings"/>.</returns>
public static LocationsSettings GetDefault() => new LocationsSettings();
/// <summary>Constructs a new <see cref="LocationsSettings"/> object with default settings.</summary>
public LocationsSettings()
{
}
private LocationsSettings(LocationsSettings existing) : base(existing)
{
gax::GaxPreconditions.CheckNotNull(existing, nameof(existing));
ListLocationsSettings = existing.ListLocationsSettings;
GetLocationSettings = existing.GetLocationSettings;
OnCopy(existing);
}
partial void OnCopy(LocationsSettings existing);
/// <summary>
/// <see cref="gaxgrpc::CallSettings"/> for synchronous and asynchronous calls to
/// <c>LocationsClient.ListLocations</c> and <c>LocationsClient.ListLocationsAsync</c>.
/// </summary>
/// <remarks>
/// <list type="bullet">
/// <item><description>This call will not be retried.</description></item>
/// <item><description>No timeout is applied.</description></item>
/// </list>
/// </remarks>
public gaxgrpc::CallSettings ListLocationsSettings { get; set; } = gaxgrpc::CallSettings.FromExpiration(gax::Expiration.None);
/// <summary>
/// <see cref="gaxgrpc::CallSettings"/> for synchronous and asynchronous calls to <c>LocationsClient.GetLocation</c>
/// and <c>LocationsClient.GetLocationAsync</c>.
/// </summary>
/// <remarks>
/// <list type="bullet">
/// <item><description>This call will not be retried.</description></item>
/// <item><description>No timeout is applied.</description></item>
/// </list>
/// </remarks>
public gaxgrpc::CallSettings GetLocationSettings { get; set; } = gaxgrpc::CallSettings.FromExpiration(gax::Expiration.None);
/// <summary>Creates a deep clone of this object, with all the same property values.</summary>
/// <returns>A deep clone of this <see cref="LocationsSettings"/> object.</returns>
public LocationsSettings Clone() => new LocationsSettings(this);
}
/// <summary>
/// Builder class for <see cref="LocationsClient"/> to provide simple configuration of credentials, endpoint etc.
/// </summary>
public sealed partial class LocationsClientBuilder : gaxgrpc::ClientBuilderBase<LocationsClient>
{
/// <summary>The settings to use for RPCs, or <c>null</c> for the default settings.</summary>
public LocationsSettings Settings { get; set; }
/// <summary>Creates a new builder with default settings.</summary>
public LocationsClientBuilder() : base(LocationsClient.ServiceMetadata)
{
}
partial void InterceptBuild(ref LocationsClient client);
partial void InterceptBuildAsync(st::CancellationToken cancellationToken, ref stt::Task<LocationsClient> task);
/// <summary>Builds the resulting client.</summary>
public override LocationsClient Build()
{
LocationsClient client = null;
InterceptBuild(ref client);
return client ?? BuildImpl();
}
/// <summary>Builds the resulting client asynchronously.</summary>
public override stt::Task<LocationsClient> BuildAsync(st::CancellationToken cancellationToken = default)
{
stt::Task<LocationsClient> task = null;
InterceptBuildAsync(cancellationToken, ref task);
return task ?? BuildAsyncImpl(cancellationToken);
}
private LocationsClient BuildImpl()
{
Validate();
grpccore::CallInvoker callInvoker = CreateCallInvoker();
return LocationsClient.Create(callInvoker, GetEffectiveSettings(Settings?.Clone()), Logger);
}
private async stt::Task<LocationsClient> BuildAsyncImpl(st::CancellationToken cancellationToken)
{
Validate();
grpccore::CallInvoker callInvoker = await CreateCallInvokerAsync(cancellationToken).ConfigureAwait(false);
return LocationsClient.Create(callInvoker, GetEffectiveSettings(Settings?.Clone()), Logger);
}
/// <summary>Returns the channel pool to use when no other options are specified.</summary>
protected override gaxgrpc::ChannelPool GetChannelPool() => LocationsClient.ChannelPool;
}
/// <summary>Locations client wrapper, for convenient use.</summary>
/// <remarks>
/// An abstract interface that provides location-related information for
/// a service. Service-specific metadata is provided through the
/// [Location.metadata][google.cloud.location.Location.metadata] field.
/// </remarks>
public abstract partial class LocationsClient
{
/// <summary>
/// The default endpoint for the Locations service, which is a host of "cloud.googleapis.com" and a port of 443.
/// </summary>
public static string DefaultEndpoint { get; } = "cloud.googleapis.com:443";
/// <summary>The default Locations scopes.</summary>
/// <remarks>
/// The default Locations scopes are:
/// <list type="bullet">
/// <item><description>https://www.googleapis.com/auth/cloud-platform</description></item>
/// </list>
/// </remarks>
public static scg::IReadOnlyList<string> DefaultScopes { get; } = new sco::ReadOnlyCollection<string>(new string[]
{
"https://www.googleapis.com/auth/cloud-platform",
});
/// <summary>The service metadata associated with this client type.</summary>
public static gaxgrpc::ServiceMetadata ServiceMetadata { get; } = new gaxgrpc::ServiceMetadata(Locations.Descriptor, DefaultEndpoint, DefaultScopes, true, gax::ApiTransports.Grpc, PackageApiMetadata.ApiMetadata);
internal static gaxgrpc::ChannelPool ChannelPool { get; } = new gaxgrpc::ChannelPool(ServiceMetadata);
/// <summary>
/// Asynchronously creates a <see cref="LocationsClient"/> using the default credentials, endpoint and settings.
/// To specify custom credentials or other settings, use <see cref="LocationsClientBuilder"/>.
/// </summary>
/// <param name="cancellationToken">
/// The <see cref="st::CancellationToken"/> to use while creating the client.
/// </param>
/// <returns>The task representing the created <see cref="LocationsClient"/>.</returns>
public static stt::Task<LocationsClient> CreateAsync(st::CancellationToken cancellationToken = default) =>
new LocationsClientBuilder().BuildAsync(cancellationToken);
/// <summary>
/// Synchronously creates a <see cref="LocationsClient"/> using the default credentials, endpoint and settings.
/// To specify custom credentials or other settings, use <see cref="LocationsClientBuilder"/>.
/// </summary>
/// <returns>The created <see cref="LocationsClient"/>.</returns>
public static LocationsClient Create() => new LocationsClientBuilder().Build();
/// <summary>
/// Creates a <see cref="LocationsClient"/> which uses the specified call invoker for remote operations.
/// </summary>
/// <param name="callInvoker">
/// The <see cref="grpccore::CallInvoker"/> for remote operations. Must not be null.
/// </param>
/// <param name="settings">Optional <see cref="LocationsSettings"/>.</param>
/// <param name="logger">Optional <see cref="mel::ILogger"/>.</param>
/// <returns>The created <see cref="LocationsClient"/>.</returns>
internal static LocationsClient Create(grpccore::CallInvoker callInvoker, LocationsSettings settings = null, mel::ILogger logger = null)
{
gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
grpcinter::Interceptor interceptor = settings?.Interceptor;
if (interceptor != null)
{
callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor);
}
Locations.LocationsClient grpcClient = new Locations.LocationsClient(callInvoker);
return new LocationsClientImpl(grpcClient, settings, logger);
}
/// <summary>
/// Shuts down any channels automatically created by <see cref="Create()"/> and
/// <see cref="CreateAsync(st::CancellationToken)"/>. Channels which weren't automatically created are not
/// affected.
/// </summary>
/// <remarks>
/// After calling this method, further calls to <see cref="Create()"/> and
/// <see cref="CreateAsync(st::CancellationToken)"/> will create new channels, which could in turn be shut down
/// by another call to this method.
/// </remarks>
/// <returns>A task representing the asynchronous shutdown operation.</returns>
public static stt::Task ShutdownDefaultChannelsAsync() => ChannelPool.ShutdownChannelsAsync();
/// <summary>The underlying gRPC Locations client</summary>
public virtual Locations.LocationsClient GrpcClient => throw new sys::NotImplementedException();
/// <summary>
/// Lists information about the supported locations for this service.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>A pageable sequence of <see cref="Location"/> resources.</returns>
public virtual gax::PagedEnumerable<ListLocationsResponse, Location> ListLocations(ListLocationsRequest request, gaxgrpc::CallSettings callSettings = null) =>
throw new sys::NotImplementedException();
/// <summary>
/// Lists information about the supported locations for this service.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>A pageable asynchronous sequence of <see cref="Location"/> resources.</returns>
public virtual gax::PagedAsyncEnumerable<ListLocationsResponse, Location> ListLocationsAsync(ListLocationsRequest request, gaxgrpc::CallSettings callSettings = null) =>
throw new sys::NotImplementedException();
/// <summary>
/// Gets information about a location.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>The RPC response.</returns>
public virtual Location GetLocation(GetLocationRequest request, gaxgrpc::CallSettings callSettings = null) =>
throw new sys::NotImplementedException();
/// <summary>
/// Gets information about a location.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>A Task containing the RPC response.</returns>
public virtual stt::Task<Location> GetLocationAsync(GetLocationRequest request, gaxgrpc::CallSettings callSettings = null) =>
throw new sys::NotImplementedException();
/// <summary>
/// Gets information about a location.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
/// <returns>A Task containing the RPC response.</returns>
public virtual stt::Task<Location> GetLocationAsync(GetLocationRequest request, st::CancellationToken cancellationToken) =>
GetLocationAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
}
/// <summary>Locations client wrapper implementation, for convenient use.</summary>
/// <remarks>
/// An abstract interface that provides location-related information for
/// a service. Service-specific metadata is provided through the
/// [Location.metadata][google.cloud.location.Location.metadata] field.
/// </remarks>
public sealed partial class LocationsClientImpl : LocationsClient
{
private readonly gaxgrpc::ApiCall<ListLocationsRequest, ListLocationsResponse> _callListLocations;
private readonly gaxgrpc::ApiCall<GetLocationRequest, Location> _callGetLocation;
/// <summary>
/// Constructs a client wrapper for the Locations service, with the specified gRPC client and settings.
/// </summary>
/// <param name="grpcClient">The underlying gRPC client.</param>
/// <param name="settings">The base <see cref="LocationsSettings"/> used within this client.</param>
/// <param name="logger">Optional <see cref="mel::ILogger"/> to use within this client.</param>
public LocationsClientImpl(Locations.LocationsClient grpcClient, LocationsSettings settings, mel::ILogger logger)
{
GrpcClient = grpcClient;
LocationsSettings effectiveSettings = settings ?? LocationsSettings.GetDefault();
gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings, logger);
_callListLocations = clientHelper.BuildApiCall<ListLocationsRequest, ListLocationsResponse>("ListLocations", grpcClient.ListLocationsAsync, grpcClient.ListLocations, effectiveSettings.ListLocationsSettings).WithGoogleRequestParam("name", request => request.Name);
Modify_ApiCall(ref _callListLocations);
Modify_ListLocationsApiCall(ref _callListLocations);
_callGetLocation = clientHelper.BuildApiCall<GetLocationRequest, Location>("GetLocation", grpcClient.GetLocationAsync, grpcClient.GetLocation, effectiveSettings.GetLocationSettings).WithGoogleRequestParam("name", request => request.Name);
Modify_ApiCall(ref _callGetLocation);
Modify_GetLocationApiCall(ref _callGetLocation);
OnConstruction(grpcClient, effectiveSettings, clientHelper);
}
partial void Modify_ApiCall<TRequest, TResponse>(ref gaxgrpc::ApiCall<TRequest, TResponse> call) where TRequest : class, proto::IMessage<TRequest> where TResponse : class, proto::IMessage<TResponse>;
partial void Modify_ListLocationsApiCall(ref gaxgrpc::ApiCall<ListLocationsRequest, ListLocationsResponse> call);
partial void Modify_GetLocationApiCall(ref gaxgrpc::ApiCall<GetLocationRequest, Location> call);
partial void OnConstruction(Locations.LocationsClient grpcClient, LocationsSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);
/// <summary>The underlying gRPC Locations client</summary>
public override Locations.LocationsClient GrpcClient { get; }
partial void Modify_ListLocationsRequest(ref ListLocationsRequest request, ref gaxgrpc::CallSettings settings);
partial void Modify_GetLocationRequest(ref GetLocationRequest request, ref gaxgrpc::CallSettings settings);
/// <summary>
/// Lists information about the supported locations for this service.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>A pageable sequence of <see cref="Location"/> resources.</returns>
public override gax::PagedEnumerable<ListLocationsResponse, Location> ListLocations(ListLocationsRequest request, gaxgrpc::CallSettings callSettings = null)
{
Modify_ListLocationsRequest(ref request, ref callSettings);
return new gaxgrpc::GrpcPagedEnumerable<ListLocationsRequest, ListLocationsResponse, Location>(_callListLocations, request, callSettings);
}
/// <summary>
/// Lists information about the supported locations for this service.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>A pageable asynchronous sequence of <see cref="Location"/> resources.</returns>
public override gax::PagedAsyncEnumerable<ListLocationsResponse, Location> ListLocationsAsync(ListLocationsRequest request, gaxgrpc::CallSettings callSettings = null)
{
Modify_ListLocationsRequest(ref request, ref callSettings);
return new gaxgrpc::GrpcPagedAsyncEnumerable<ListLocationsRequest, ListLocationsResponse, Location>(_callListLocations, request, callSettings);
}
/// <summary>
/// Gets information about a location.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>The RPC response.</returns>
public override Location GetLocation(GetLocationRequest request, gaxgrpc::CallSettings callSettings = null)
{
Modify_GetLocationRequest(ref request, ref callSettings);
return _callGetLocation.Sync(request, callSettings);
}
/// <summary>
/// Gets information about a location.
/// </summary>
/// <param name="request">The request object containing all of the parameters for the API call.</param>
/// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
/// <returns>A Task containing the RPC response.</returns>
public override stt::Task<Location> GetLocationAsync(GetLocationRequest request, gaxgrpc::CallSettings callSettings = null)
{
Modify_GetLocationRequest(ref request, ref callSettings);
return _callGetLocation.Async(request, callSettings);
}
}
public partial class ListLocationsRequest : gaxgrpc::IPageRequest
{
}
public partial class ListLocationsResponse : gaxgrpc::IPageResponse<Location>
{
/// <summary>Returns an enumerator that iterates through the resources in this response.</summary>
public scg::IEnumerator<Location> GetEnumerator() => Locations.GetEnumerator();
sc::IEnumerator sc::IEnumerable.GetEnumerator() => GetEnumerator();
}
}