private FirestoreAdminSettings(FirestoreAdminSettings existing) : base(existing) { GaxPreconditions.CheckNotNull(existing, nameof(existing)); CreateIndexSettings = existing.CreateIndexSettings; ListIndexesSettings = existing.ListIndexesSettings; GetIndexSettings = existing.GetIndexSettings; DeleteIndexSettings = existing.DeleteIndexSettings; OnCopy(existing); }
/// <summary> /// Constructs a client wrapper for the FirestoreAdmin service, with the specified gRPC client and settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="FirestoreAdminSettings"/> used within this client </param> public FirestoreAdminClientImpl(FirestoreAdmin.FirestoreAdminClient grpcClient, FirestoreAdminSettings settings) { GrpcClient = grpcClient; FirestoreAdminSettings effectiveSettings = settings ?? FirestoreAdminSettings.GetDefault(); ClientHelper clientHelper = new ClientHelper(effectiveSettings); _callCreateIndex = clientHelper.BuildApiCall <CreateIndexRequest, Operation>( GrpcClient.CreateIndexAsync, GrpcClient.CreateIndex, effectiveSettings.CreateIndexSettings); _callListIndexes = clientHelper.BuildApiCall <ListIndexesRequest, ListIndexesResponse>( GrpcClient.ListIndexesAsync, GrpcClient.ListIndexes, effectiveSettings.ListIndexesSettings); _callGetIndex = clientHelper.BuildApiCall <GetIndexRequest, Index>( GrpcClient.GetIndexAsync, GrpcClient.GetIndex, effectiveSettings.GetIndexSettings); _callDeleteIndex = clientHelper.BuildApiCall <DeleteIndexRequest, Empty>( GrpcClient.DeleteIndexAsync, GrpcClient.DeleteIndex, effectiveSettings.DeleteIndexSettings); OnConstruction(grpcClient, effectiveSettings, clientHelper); }
partial void OnConstruction(FirestoreAdmin.FirestoreAdminClient grpcClient, FirestoreAdminSettings effectiveSettings, ClientHelper clientHelper);
partial void OnCopy(FirestoreAdminSettings existing);
/// <summary> /// Creates a <see cref="FirestoreAdminClient"/> which uses the specified channel for remote operations. /// </summary> /// <param name="channel">The <see cref="Channel"/> for remote operations. Must not be null.</param> /// <param name="settings">Optional <see cref="FirestoreAdminSettings"/>.</param> /// <returns>The created <see cref="FirestoreAdminClient"/>.</returns> public static FirestoreAdminClient Create(Channel channel, FirestoreAdminSettings settings = null) { GaxPreconditions.CheckNotNull(channel, nameof(channel)); FirestoreAdmin.FirestoreAdminClient grpcClient = new FirestoreAdmin.FirestoreAdminClient(channel); return(new FirestoreAdminClientImpl(grpcClient, settings)); }
/// <summary> /// Synchronously creates a <see cref="FirestoreAdminClient"/>, applying defaults for all unspecified settings, /// and creating a channel connecting to the given endpoint with application default credentials where /// necessary. /// </summary> /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param> /// <param name="settings">Optional <see cref="FirestoreAdminSettings"/>.</param> /// <returns>The created <see cref="FirestoreAdminClient"/>.</returns> public static FirestoreAdminClient Create(ServiceEndpoint endpoint = null, FirestoreAdminSettings settings = null) { Channel channel = s_channelPool.GetChannel(endpoint ?? DefaultEndpoint); return(Create(channel, settings)); }
// Note: we could have parameterless overloads of Create and CreateAsync, // documented to just use the default endpoint, settings and credentials. // Pros: // - Might be more reassuring on first use // - Allows method group conversions // Con: overloads! /// <summary> /// Asynchronously creates a <see cref="FirestoreAdminClient"/>, applying defaults for all unspecified settings, /// and creating a channel connecting to the given endpoint with application default credentials where /// necessary. /// </summary> /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param> /// <param name="settings">Optional <see cref="FirestoreAdminSettings"/>.</param> /// <returns>The task representing the created <see cref="FirestoreAdminClient"/>.</returns> public static async Task <FirestoreAdminClient> CreateAsync(ServiceEndpoint endpoint = null, FirestoreAdminSettings settings = null) { Channel channel = await s_channelPool.GetChannelAsync(endpoint ?? DefaultEndpoint).ConfigureAwait(false); return(Create(channel, settings)); }