示例#1
0
 private AutoscalingPolicyServiceSettings(AutoscalingPolicyServiceSettings existing) : base(existing)
 {
     gax::GaxPreconditions.CheckNotNull(existing, nameof(existing));
     CreateAutoscalingPolicySettings = existing.CreateAutoscalingPolicySettings;
     UpdateAutoscalingPolicySettings = existing.UpdateAutoscalingPolicySettings;
     GetAutoscalingPolicySettings    = existing.GetAutoscalingPolicySettings;
     ListAutoscalingPoliciesSettings = existing.ListAutoscalingPoliciesSettings;
     DeleteAutoscalingPolicySettings = existing.DeleteAutoscalingPolicySettings;
     OnCopy(existing);
 }
示例#2
0
        /// <summary>
        /// Constructs a client wrapper for the AutoscalingPolicyService service, with the specified gRPC client and
        /// settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">
        /// The base <see cref="AutoscalingPolicyServiceSettings"/> used within this client.
        /// </param>
        public AutoscalingPolicyServiceClientImpl(AutoscalingPolicyService.AutoscalingPolicyServiceClient grpcClient, AutoscalingPolicyServiceSettings settings)
        {
            GrpcClient = grpcClient;
            AutoscalingPolicyServiceSettings effectiveSettings = settings ?? AutoscalingPolicyServiceSettings.GetDefault();
            gaxgrpc::ClientHelper            clientHelper      = new gaxgrpc::ClientHelper(effectiveSettings);

            _callCreateAutoscalingPolicy = clientHelper.BuildApiCall <CreateAutoscalingPolicyRequest, AutoscalingPolicy>(grpcClient.CreateAutoscalingPolicyAsync, grpcClient.CreateAutoscalingPolicy, effectiveSettings.CreateAutoscalingPolicySettings).WithGoogleRequestParam("parent", request => request.Parent);
            Modify_ApiCall(ref _callCreateAutoscalingPolicy);
            Modify_CreateAutoscalingPolicyApiCall(ref _callCreateAutoscalingPolicy);
            _callUpdateAutoscalingPolicy = clientHelper.BuildApiCall <UpdateAutoscalingPolicyRequest, AutoscalingPolicy>(grpcClient.UpdateAutoscalingPolicyAsync, grpcClient.UpdateAutoscalingPolicy, effectiveSettings.UpdateAutoscalingPolicySettings).WithGoogleRequestParam("policy.name", request => request.Policy?.Name);
            Modify_ApiCall(ref _callUpdateAutoscalingPolicy);
            Modify_UpdateAutoscalingPolicyApiCall(ref _callUpdateAutoscalingPolicy);
            _callGetAutoscalingPolicy = clientHelper.BuildApiCall <GetAutoscalingPolicyRequest, AutoscalingPolicy>(grpcClient.GetAutoscalingPolicyAsync, grpcClient.GetAutoscalingPolicy, effectiveSettings.GetAutoscalingPolicySettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callGetAutoscalingPolicy);
            Modify_GetAutoscalingPolicyApiCall(ref _callGetAutoscalingPolicy);
            _callListAutoscalingPolicies = clientHelper.BuildApiCall <ListAutoscalingPoliciesRequest, ListAutoscalingPoliciesResponse>(grpcClient.ListAutoscalingPoliciesAsync, grpcClient.ListAutoscalingPolicies, effectiveSettings.ListAutoscalingPoliciesSettings).WithGoogleRequestParam("parent", request => request.Parent);
            Modify_ApiCall(ref _callListAutoscalingPolicies);
            Modify_ListAutoscalingPoliciesApiCall(ref _callListAutoscalingPolicies);
            _callDeleteAutoscalingPolicy = clientHelper.BuildApiCall <DeleteAutoscalingPolicyRequest, wkt::Empty>(grpcClient.DeleteAutoscalingPolicyAsync, grpcClient.DeleteAutoscalingPolicy, effectiveSettings.DeleteAutoscalingPolicySettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callDeleteAutoscalingPolicy);
            Modify_DeleteAutoscalingPolicyApiCall(ref _callDeleteAutoscalingPolicy);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
示例#3
0
 partial void OnCopy(AutoscalingPolicyServiceSettings existing);
示例#4
0
 partial void OnConstruction(AutoscalingPolicyService.AutoscalingPolicyServiceClient grpcClient, AutoscalingPolicyServiceSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);
示例#5
0
        /// <summary>
        /// Creates a <see cref="AutoscalingPolicyServiceClient"/> 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="AutoscalingPolicyServiceSettings"/>.</param>
        /// <returns>The created <see cref="AutoscalingPolicyServiceClient"/>.</returns>
        internal static AutoscalingPolicyServiceClient Create(grpccore::CallInvoker callInvoker, AutoscalingPolicyServiceSettings settings = null)
        {
            gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
            grpcinter::Interceptor interceptor = settings?.Interceptor;

            if (interceptor != null)
            {
                callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor);
            }
            AutoscalingPolicyService.AutoscalingPolicyServiceClient grpcClient = new AutoscalingPolicyService.AutoscalingPolicyServiceClient(callInvoker);
            return(new AutoscalingPolicyServiceClientImpl(grpcClient, settings));
        }