public async stt::Task CreateMigrationWorkflowRequestObjectAsync()
        {
            moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict);
            CreateMigrationWorkflowRequest request = new CreateMigrationWorkflowRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                MigrationWorkflow    = new MigrationWorkflow(),
            };
            MigrationWorkflow expectedResponse = new MigrationWorkflow
            {
                MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Tasks =
                {
                    {
                        "key8a0b6e3c",
                        new MigrationTask()
                    },
                },
                State          = MigrationWorkflow.Types.State.Paused,
                CreateTime     = new wkt::Timestamp(),
                LastUpdateTime = new wkt::Timestamp(),
                DisplayName    = "display_name137f65c2",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetMigrationWorkflowResourceNames()
        {
            moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict);
            GetMigrationWorkflowRequest request = new GetMigrationWorkflowRequest
            {
                MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };
            MigrationWorkflow expectedResponse = new MigrationWorkflow
            {
                MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Tasks =
                {
                    {
                        "key8a0b6e3c",
                        new MigrationTask()
                    },
                },
                State          = MigrationWorkflow.Types.State.Paused,
                CreateTime     = new wkt::Timestamp(),
                LastUpdateTime = new wkt::Timestamp(),
                DisplayName    = "display_name137f65c2",
            };

            mockGrpcClient.Setup(x => x.GetMigrationWorkflow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MigrationServiceClient client   = new MigrationServiceClientImpl(mockGrpcClient.Object, null);
            MigrationWorkflow      response = client.GetMigrationWorkflow(request.MigrationWorkflowName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #3
0
 /// <summary>Snippet for GetMigrationWorkflow</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetMigrationWorkflowResourceNames()
 {
     // Create client
     MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create();
     // Initialize request argument(s)
     MigrationWorkflowName name = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
     // Make the request
     MigrationWorkflow response = migrationServiceClient.GetMigrationWorkflow(name);
 }
        /// <summary>Snippet for StartMigrationWorkflowAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task StartMigrationWorkflowResourceNamesAsync()
        {
            // Create client
            MigrationServiceClient migrationServiceClient = await MigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            MigrationWorkflowName name = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            // Make the request
            await migrationServiceClient.StartMigrationWorkflowAsync(name);
        }
        /// <summary>Snippet for DeleteMigrationWorkflowAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteMigrationWorkflowRequestObjectAsync()
        {
            // Create client
            MigrationServiceClient migrationServiceClient = await MigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteMigrationWorkflowRequest request = new DeleteMigrationWorkflowRequest
            {
                MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };
            // Make the request
            await migrationServiceClient.DeleteMigrationWorkflowAsync(request);
        }
 /// <summary>Snippet for GetMigrationWorkflow</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetMigrationWorkflowRequestObject()
 {
     // Create client
     MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create();
     // Initialize request argument(s)
     GetMigrationWorkflowRequest request = new GetMigrationWorkflowRequest
     {
         MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
         ReadMask = new FieldMask(),
     };
     // Make the request
     MigrationWorkflow response = migrationServiceClient.GetMigrationWorkflow(request);
 }
        /// <summary>Snippet for StartMigrationWorkflow</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void StartMigrationWorkflowRequestObject()
        {
            // Create client
            MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create();
            // Initialize request argument(s)
            StartMigrationWorkflowRequest request = new StartMigrationWorkflowRequest
            {
                MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };

            // Make the request
            migrationServiceClient.StartMigrationWorkflow(request);
        }
예제 #8
0
        /// <summary>Snippet for ListMigrationSubtasksAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task ListMigrationSubtasksRequestObjectAsync()
        {
            // Create client
            MigrationServiceClient migrationServiceClient = await MigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListMigrationSubtasksRequest request = new ListMigrationSubtasksRequest
            {
                ParentAsMigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                ReadMask = new FieldMask(),
                Filter   = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListMigrationSubtasksResponse, MigrationSubtask> response = migrationServiceClient.ListMigrationSubtasksAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((MigrationSubtask item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListMigrationSubtasksResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (MigrationSubtask item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <MigrationSubtask> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (MigrationSubtask item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
        }
        public void StartMigrationWorkflowResourceNames()
        {
            moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict);
            StartMigrationWorkflowRequest request = new StartMigrationWorkflowRequest
            {
                MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.StartMigrationWorkflow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null);

            client.StartMigrationWorkflow(request.MigrationWorkflowName);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task StartMigrationWorkflowResourceNamesAsync()
        {
            moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict);
            StartMigrationWorkflowRequest request = new StartMigrationWorkflowRequest
            {
                MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.StartMigrationWorkflowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null);
            await client.StartMigrationWorkflowAsync(request.MigrationWorkflowName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.StartMigrationWorkflowAsync(request.MigrationWorkflowName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for ListMigrationSubtasks</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListMigrationSubtasksResourceNames()
        {
            // Create client
            MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create();
            // Initialize request argument(s)
            MigrationWorkflowName parent = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            // Make the request
            PagedEnumerable <ListMigrationSubtasksResponse, MigrationSubtask> response = migrationServiceClient.ListMigrationSubtasks(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (MigrationSubtask item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListMigrationSubtasksResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (MigrationSubtask item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <MigrationSubtask> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (MigrationSubtask item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
        }