public async stt::Task GetSchemaRequestObjectAsync()
        {
            moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict);
            GetSchemaRequest request = new GetSchemaRequest
            {
                SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
                View       = SchemaView.Basic,
            };
            Schema expectedResponse = new Schema
            {
                SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
                Type       = Schema.Types.Type.Unspecified,
                Definition = "definition3b8b6130",
            };

            mockGrpcClient.Setup(x => x.GetSchemaAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Schema>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SchemaServiceClient client  = new SchemaServiceClientImpl(mockGrpcClient.Object, null);
            Schema responseCallSettings = await client.GetSchemaAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Schema responseCancellationToken = await client.GetSchemaAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetSchemaRequest request;

            try
            {
                request = new GetSchemaRequest
                {
                    RegistryId         = RegistryId,
                    ConnectionKey      = ConnectionKey,
                    SchemaResourceName = SchemaResourceName,
                    OpcRequestId       = OpcRequestId,
                    EndpointId         = EndpointId
                };

                response = client.GetSchema(request).GetAwaiter().GetResult();
                WriteOutput(response, response.Schema);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
    public Schema GetSchema(string projectId, string schemaId)
    {
        SchemaServiceClient schemaService = SchemaServiceClient.Create();
        SchemaName          schemaName    = SchemaName.FromProjectSchema(projectId, schemaId);
        GetSchemaRequest    request       = new GetSchemaRequest
        {
            Name = schemaName.ToString(),
            View = SchemaView.Full
        };

        return(schemaService.GetSchema(request));
    }
예제 #4
0
 /// <summary>Snippet for GetSchema</summary>
 public void GetSchemaRequestObject()
 {
     // Snippet: GetSchema(GetSchemaRequest, CallSettings)
     // Create client
     SchemaServiceClient schemaServiceClient = SchemaServiceClient.Create();
     // Initialize request argument(s)
     GetSchemaRequest request = new GetSchemaRequest
     {
         SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
         View       = SchemaView.Unspecified,
     };
     // Make the request
     Schema response = schemaServiceClient.GetSchema(request);
     // End snippet
 }
예제 #5
0
        /// <summary>Snippet for GetSchemaAsync</summary>
        public async Task GetSchemaRequestObjectAsync()
        {
            // Snippet: GetSchemaAsync(GetSchemaRequest, CallSettings)
            // Additional: GetSchemaAsync(GetSchemaRequest, CancellationToken)
            // Create client
            SchemaServiceClient schemaServiceClient = await SchemaServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetSchemaRequest request = new GetSchemaRequest
            {
                SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
                View       = SchemaView.Unspecified,
            };
            // Make the request
            Schema response = await schemaServiceClient.GetSchemaAsync(request);

            // End snippet
        }
        public void GetSchemaResourceNames()
        {
            moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict);
            GetSchemaRequest request = new GetSchemaRequest
            {
                SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
            };
            Schema expectedResponse = new Schema
            {
                SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"),
                Type       = Schema.Types.Type.Unspecified,
                Definition = "definition3b8b6130",
            };

            mockGrpcClient.Setup(x => x.GetSchema(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null);
            Schema response            = client.GetSchema(request.SchemaName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }