/// <summary>Snippet for GetApiConfig</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetApiConfigRequestObject() { // Create client ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create(); // Initialize request argument(s) GetApiConfigRequest request = new GetApiConfigRequest { ApiConfigName = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]"), View = GetApiConfigRequest.Types.ConfigView.Unspecified, }; // Make the request ApiConfig response = apiGatewayServiceClient.GetApiConfig(request); }
public async stt::Task GetApiConfigRequestObjectAsync() { moq::Mock <ApiGatewayService.ApiGatewayServiceClient> mockGrpcClient = new moq::Mock <ApiGatewayService.ApiGatewayServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetApiConfigRequest request = new GetApiConfigRequest { ApiConfigName = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]"), View = GetApiConfigRequest.Types.ConfigView.Basic, }; ApiConfig expectedResponse = new ApiConfig { ApiConfigName = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, DisplayName = "display_name137f65c2", State = ApiConfig.Types.State.Activating, OpenapiDocuments = { new ApiConfig.Types.OpenApiDocument(), }, GrpcServices = { new ApiConfig.Types.GrpcServiceDefinition(), }, ManagedServiceConfigs = { new ApiConfig.Types.File(), }, ServiceConfigIdAsServiceName = ServiceName.FromServiceConfig("[SERVICE]", "[CONFIG]"), GatewayServiceAccountAsServiceAccountName = ServiceAccountName.FromProjectServiceAccount("[PROJECT]", "[SERVICE_ACCOUNT]"), }; mockGrpcClient.Setup(x => x.GetApiConfigAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ApiConfig>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ApiGatewayServiceClient client = new ApiGatewayServiceClientImpl(mockGrpcClient.Object, null); ApiConfig responseCallSettings = await client.GetApiConfigAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ApiConfig responseCancellationToken = await client.GetApiConfigAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetApiConfigResourceNames() { moq::Mock <ApiGatewayService.ApiGatewayServiceClient> mockGrpcClient = new moq::Mock <ApiGatewayService.ApiGatewayServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetApiConfigRequest request = new GetApiConfigRequest { ApiConfigName = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]"), }; ApiConfig expectedResponse = new ApiConfig { ApiConfigName = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, DisplayName = "display_name137f65c2", State = ApiConfig.Types.State.Activating, OpenapiDocuments = { new ApiConfig.Types.OpenApiDocument(), }, GrpcServices = { new ApiConfig.Types.GrpcServiceDefinition(), }, ManagedServiceConfigs = { new ApiConfig.Types.File(), }, ServiceConfigIdAsServiceName = ServiceName.FromServiceConfig("[SERVICE]", "[CONFIG]"), GatewayServiceAccountAsServiceAccountName = ServiceAccountName.FromProjectServiceAccount("[PROJECT]", "[SERVICE_ACCOUNT]"), }; mockGrpcClient.Setup(x => x.GetApiConfig(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ApiGatewayServiceClient client = new ApiGatewayServiceClientImpl(mockGrpcClient.Object, null); ApiConfig response = client.GetApiConfig(request.ApiConfigName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }