コード例 #1
0
        public void GetEnvironment()
        {
            moq::Mock <Environments.EnvironmentsClient> mockGrpcClient = new moq::Mock <Environments.EnvironmentsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
                DisplayName     = "display_name137f65c2",
                Description     = "description2cf9da67",
                UpdateTime      = new wkt::Timestamp(),
                VersionConfigs  =
                {
                    new Environment.Types.VersionConfig(),
                },
                TestCasesConfig = new Environment.Types.TestCasesConfig(),
            };

            mockGrpcClient.Setup(x => x.GetEnvironment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            EnvironmentsClient client   = new EnvironmentsClientImpl(mockGrpcClient.Object, null);
            Environment        response = client.GetEnvironment(request.Name);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public async stt::Task GetEnvironmentRequestObjectAsync()
        {
            moq::Mock <Environments.EnvironmentsClient> mockGrpcClient = new moq::Mock <Environments.EnvironmentsClient>(moq::MockBehavior.Strict);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName           = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
                Description               = "description2cf9da67",
                AgentVersionAsVersionName = VersionName.FromProjectVersion("[PROJECT]", "[VERSION]"),
                State                = Environment.Types.State.Loading,
                UpdateTime           = new wkt::Timestamp(),
                TextToSpeechSettings = new TextToSpeechSettings(),
                Fulfillment          = new Fulfillment(),
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
        public async stt::Task GetEnvironmentRequestObjectAsync()
        {
            moq::Mock <Environments.EnvironmentsClient> mockGrpcClient = new moq::Mock <Environments.EnvironmentsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
                DisplayName     = "display_name137f65c2",
                Description     = "description2cf9da67",
                UpdateTime      = new wkt::Timestamp(),
                VersionConfigs  =
                {
                    new Environment.Types.VersionConfig(),
                },
                TestCasesConfig = new Environment.Types.TestCasesConfig(),
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public async stt::Task GetEnvironmentRequestObjectAsync()
        {
            moq::Mock <NotebookService.NotebookServiceClient> mockGrpcClient = new moq::Mock <NotebookService.NotebookServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                Name = "name1c9368b0",
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName   = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
                DisplayName       = "display_name137f65c2",
                Description       = "description2cf9da67",
                VmImage           = new VmImage(),
                ContainerImage    = new ContainerImage(),
                PostStartupScript = "post_startup_script0d185c71",
                CreateTime        = new wkt::Timestamp(),
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #5
0
        public void GetEnvironmentRequestObject()
        {
            moq::Mock <Environments.EnvironmentsClient> mockGrpcClient = new moq::Mock <Environments.EnvironmentsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                Name = "name1c9368b0",
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName = EnvironmentName.FromProjectLocationEnvironment("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]"),
                Config          = new EnvironmentConfig(),
                Uuid            = "uuid6f877cef",
                State           = Environment.Types.State.Unspecified,
                CreateTime      = new wkt::Timestamp(),
                UpdateTime      = new wkt::Timestamp(),
                Labels          =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

            mockGrpcClient.Setup(x => x.GetEnvironment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            EnvironmentsClient client   = new EnvironmentsClientImpl(mockGrpcClient.Object, null);
            Environment        response = client.GetEnvironment(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #6
0
        public async stt::Task GetEnvironmentRequestObjectAsync()
        {
            moq::Mock <CloudShellService.CloudShellServiceClient> mockGrpcClient = new moq::Mock <CloudShellService.CloudShellServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromUserEnvironment("[USER]", "[ENVIRONMENT]"),
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName = EnvironmentName.FromUserEnvironment("[USER]", "[ENVIRONMENT]"),
                Id          = "id74b70bb8",
                DockerImage = "docker_image790036d7",
                State       = Environment.Types.State.Running,
                SshUsername = "******",
                SshHost     = "ssh_hostf6f9047e",
                SshPort     = 385289463,
                PublicKeys  =
                {
                    "public_keys8ff48db4",
                },
                WebHost = "web_hosta5049b32",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #7
0
        public void GetEnvironmentResourceNames()
        {
            moq::Mock <CloudShellService.CloudShellServiceClient> mockGrpcClient = new moq::Mock <CloudShellService.CloudShellServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromUserEnvironment("[USER]", "[ENVIRONMENT]"),
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName = EnvironmentName.FromUserEnvironment("[USER]", "[ENVIRONMENT]"),
                Id          = "id74b70bb8",
                DockerImage = "docker_image790036d7",
                State       = Environment.Types.State.Running,
                SshUsername = "******",
                SshHost     = "ssh_hostf6f9047e",
                SshPort     = 385289463,
                PublicKeys  =
                {
                    "public_keys8ff48db4",
                },
                WebHost = "web_hosta5049b32",
            };

            mockGrpcClient.Setup(x => x.GetEnvironment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CloudShellServiceClient client   = new CloudShellServiceClientImpl(mockGrpcClient.Object, null);
            Environment             response = client.GetEnvironment(request.EnvironmentName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #8
0
        public void GetEnvironmentRequestObject()
        {
            moq::Mock <Environments.EnvironmentsClient> mockGrpcClient = new moq::Mock <Environments.EnvironmentsClient>(moq::MockBehavior.Strict);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName           = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
                Description               = "description2cf9da67",
                AgentVersionAsVersionName = VersionName.FromProjectVersion("[PROJECT]", "[VERSION]"),
                State                = Environment.Types.State.Loading,
                UpdateTime           = new wkt::Timestamp(),
                TextToSpeechSettings = new TextToSpeechSettings(),
                Fulfillment          = new Fulfillment(),
            };

            mockGrpcClient.Setup(x => x.GetEnvironment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            EnvironmentsClient client   = new EnvironmentsClientImpl(mockGrpcClient.Object, null);
            Environment        response = client.GetEnvironment(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #9
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetEnvironment operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetEnvironment operation on AmazonFinspaceClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetEnvironment
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/finspace-2021-03-12/GetEnvironment">REST API Reference for GetEnvironment Operation</seealso>
        public virtual IAsyncResult BeginGetEnvironment(GetEnvironmentRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetEnvironmentRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetEnvironmentResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
コード例 #10
0
        internal virtual GetEnvironmentResponse GetEnvironment(GetEnvironmentRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetEnvironmentRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetEnvironmentResponseUnmarshaller.Instance;

            return(Invoke <GetEnvironmentResponse>(request, options));
        }
コード例 #11
0
        /// <summary>
        /// Retrieves the details of an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetEnvironment service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the GetEnvironment service method, as returned by MWAA.</returns>
        /// <exception cref="Amazon.MWAA.Model.InternalServerException">
        /// InternalServerException: An internal error has occurred.
        /// </exception>
        /// <exception cref="Amazon.MWAA.Model.ResourceNotFoundException">
        /// ResourceNotFoundException: The resource is not available.
        /// </exception>
        /// <exception cref="Amazon.MWAA.Model.ValidationException">
        /// ValidationException: The provided input is not valid.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mwaa-2020-07-01/GetEnvironment">REST API Reference for GetEnvironment Operation</seealso>
        public virtual Task <GetEnvironmentResponse> GetEnvironmentAsync(GetEnvironmentRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetEnvironmentRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetEnvironmentResponseUnmarshaller.Instance;

            return(InvokeAsync <GetEnvironmentResponse>(request, options, cancellationToken));
        }
コード例 #12
0
 /// <summary>Snippet for GetEnvironment</summary>
 public void GetEnvironmentRequestObject()
 {
     // Snippet: GetEnvironment(GetEnvironmentRequest, CallSettings)
     // Create client
     EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
     // Initialize request argument(s)
     GetEnvironmentRequest request = new GetEnvironmentRequest {
         Name = "",
     };
     // Make the request
     gcoasv::Environment response = environmentsClient.GetEnvironment(request);
     // End snippet
 }
 /// <summary>Snippet for GetEnvironment</summary>
 public void GetEnvironmentRequestObject()
 {
     // Snippet: GetEnvironment(GetEnvironmentRequest, CallSettings)
     // Create client
     CloudShellServiceClient cloudShellServiceClient = CloudShellServiceClient.Create();
     // Initialize request argument(s)
     GetEnvironmentRequest request = new GetEnvironmentRequest
     {
         EnvironmentName = EnvironmentName.FromUserEnvironment("[USER]", "[ENVIRONMENT]"),
     };
     // Make the request
     Environment response = cloudShellServiceClient.GetEnvironment(request);
     // End snippet
 }
コード例 #14
0
 /// <summary>Snippet for GetEnvironment</summary>
 public void GetEnvironmentRequestObject()
 {
     // Snippet: GetEnvironment(GetEnvironmentRequest, CallSettings)
     // Create client
     EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
     // Initialize request argument(s)
     GetEnvironmentRequest request = new GetEnvironmentRequest
     {
         EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
     };
     // Make the request
     gcdv::Environment response = environmentsClient.GetEnvironment(request);
     // End snippet
 }
コード例 #15
0
        /// <summary>Snippet for GetEnvironmentAsync</summary>
        public async Task GetEnvironmentRequestObjectAsync()
        {
            // Snippet: GetEnvironmentAsync(GetEnvironmentRequest, CallSettings)
            // Additional: GetEnvironmentAsync(GetEnvironmentRequest, CancellationToken)
            // Create client
            EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();

            // Initialize request argument(s)
            GetEnvironmentRequest request = new GetEnvironmentRequest {
                Name = "",
            };
            // Make the request
            gcoasv::Environment response = await environmentsClient.GetEnvironmentAsync(request);

            // End snippet
        }
        /// <summary>Snippet for GetEnvironmentAsync</summary>
        public async Task GetEnvironmentRequestObjectAsync()
        {
            // Snippet: GetEnvironmentAsync(GetEnvironmentRequest, CallSettings)
            // Additional: GetEnvironmentAsync(GetEnvironmentRequest, CancellationToken)
            // Create client
            CloudShellServiceClient cloudShellServiceClient = await CloudShellServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromUserEnvironment("[USER]", "[ENVIRONMENT]"),
            };
            // Make the request
            Environment response = await cloudShellServiceClient.GetEnvironmentAsync(request);

            // End snippet
        }
コード例 #17
0
        /// <summary>Snippet for GetEnvironmentAsync</summary>
        public async Task GetEnvironmentRequestObjectAsync()
        {
            // Snippet: GetEnvironmentAsync(GetEnvironmentRequest, CallSettings)
            // Additional: GetEnvironmentAsync(GetEnvironmentRequest, CancellationToken)
            // Create client
            EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();

            // Initialize request argument(s)
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
            };
            // Make the request
            gcdv::Environment response = await environmentsClient.GetEnvironmentAsync(request);

            // End snippet
        }
コード例 #18
0
        public async Task <ActualState> GetCurrentStateByEnvironmentAsync(Guid environmentId, CancellationToken cancellationToken = default)
        {
            if (environmentId == Guid.Empty)
            {
                throw new ArgumentException("environmentId");
            }

            var request = new GetEnvironmentRequest(environmentId);

            var response = await SendAsync(request, cancellationToken);

            if (!response.IsSuccessStatusCode)
            {
                return(await Task.FromResult(default(ActualState)));
            }

            var payload = JsonSerializer.Deserialize <ActualState>(await response.Content.ReadAsStringAsync());

            return(payload);
        }
コード例 #19
0
        public async stt::Task GetEnvironmentRequestObjectAsync()
        {
            moq::Mock <Environments.EnvironmentsClient> mockGrpcClient = new moq::Mock <Environments.EnvironmentsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEnvironmentRequest request = new GetEnvironmentRequest
            {
                Name = "name1c9368b0",
            };
            Environment expectedResponse = new Environment
            {
                EnvironmentName = EnvironmentName.FromProjectLocationEnvironment("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]"),
                Config          = new EnvironmentConfig(),
                Uuid            = "uuid6f877cef",
                State           = Environment.Types.State.Unspecified,
                CreateTime      = new wkt::Timestamp(),
                UpdateTime      = new wkt::Timestamp(),
                Labels          =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #20
0
 public EnvironmentDto Get(GetEnvironmentRequest request)
 {
     return(GetEnvironment(request.Name, false).Environment);
 }
コード例 #21
0
 public EnvironmentDto Get(GetEnvironmentRequest request)
 {
     return GetEnvironment(request.Name, false).Environment;
 }