Example #1
0
        /// <summary>Snippet for CreateConnectionProfile</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateConnectionProfileResourceNames()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            ConnectionProfileName parent            = ConnectionProfileName.FromProjectLocationConnectionProfile("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]");
            ConnectionProfile     connectionProfile = new ConnectionProfile();
            string connectionProfileId = "";
            // Make the request
            Operation <ConnectionProfile, OperationMetadata> response = dataMigrationServiceClient.CreateConnectionProfile(parent, connectionProfile, connectionProfileId);

            // Poll until the returned long-running operation is complete
            Operation <ConnectionProfile, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            ConnectionProfile result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ConnectionProfile, OperationMetadata> retrievedResponse = dataMigrationServiceClient.PollOnceCreateConnectionProfile(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ConnectionProfile retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for CreateMigrationJob</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateMigrationJob()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            string       parent         = "projects/[PROJECT]/locations/[LOCATION]";
            MigrationJob migrationJob   = new MigrationJob();
            string       migrationJobId = "";
            // Make the request
            Operation <MigrationJob, OperationMetadata> response = dataMigrationServiceClient.CreateMigrationJob(parent, migrationJob, migrationJobId);

            // Poll until the returned long-running operation is complete
            Operation <MigrationJob, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            MigrationJob result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <MigrationJob, OperationMetadata> retrievedResponse = dataMigrationServiceClient.PollOnceCreateMigrationJob(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                MigrationJob retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for DeleteConnectionProfile</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteConnectionProfile()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/connectionProfiles/[CONNECTION_PROFILE]";
            // Make the request
            Operation <Empty, OperationMetadata> response = dataMigrationServiceClient.DeleteConnectionProfile(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = dataMigrationServiceClient.PollOnceDeleteConnectionProfile(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
Example #4
0
        /// <summary>Snippet for UpdateConnectionProfile</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void UpdateConnectionProfileRequestObject()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            UpdateConnectionProfileRequest request = new UpdateConnectionProfileRequest
            {
                UpdateMask        = new FieldMask(),
                ConnectionProfile = new ConnectionProfile(),
                RequestId         = "",
            };
            // Make the request
            Operation <ConnectionProfile, OperationMetadata> response = dataMigrationServiceClient.UpdateConnectionProfile(request);

            // Poll until the returned long-running operation is complete
            Operation <ConnectionProfile, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            ConnectionProfile result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ConnectionProfile, OperationMetadata> retrievedResponse = dataMigrationServiceClient.PollOnceUpdateConnectionProfile(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ConnectionProfile retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for UpdateMigrationJob</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void UpdateMigrationJob()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            MigrationJob migrationJob = new MigrationJob();
            FieldMask    updateMask   = new FieldMask();
            // Make the request
            Operation <MigrationJob, OperationMetadata> response = dataMigrationServiceClient.UpdateMigrationJob(migrationJob, updateMask);

            // Poll until the returned long-running operation is complete
            Operation <MigrationJob, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            MigrationJob result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <MigrationJob, OperationMetadata> retrievedResponse = dataMigrationServiceClient.PollOnceUpdateMigrationJob(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                MigrationJob retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for DeleteConnectionProfile</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteConnectionProfileRequestObject()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            DeleteConnectionProfileRequest request = new DeleteConnectionProfileRequest
            {
                ConnectionProfileName = ConnectionProfileName.FromProjectLocationConnectionProfile("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"),
                RequestId             = "",
                Force = false,
            };
            // Make the request
            Operation <Empty, OperationMetadata> response = dataMigrationServiceClient.DeleteConnectionProfile(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = dataMigrationServiceClient.PollOnceDeleteConnectionProfile(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for StartMigrationJob</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void StartMigrationJobRequestObject()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            StartMigrationJobRequest request = new StartMigrationJobRequest
            {
                MigrationJobName = MigrationJobName.FromProjectLocationMigrationJob("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"),
            };
            // Make the request
            Operation <MigrationJob, OperationMetadata> response = dataMigrationServiceClient.StartMigrationJob(request);

            // Poll until the returned long-running operation is complete
            Operation <MigrationJob, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            MigrationJob result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <MigrationJob, OperationMetadata> retrievedResponse = dataMigrationServiceClient.PollOnceStartMigrationJob(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                MigrationJob retrievedResult = retrievedResponse.Result;
            }
        }
Example #8
0
 /// <summary>Snippet for GetMigrationJob</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetMigrationJobResourceNames()
 {
     // Create client
     DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
     // Initialize request argument(s)
     MigrationJobName name = MigrationJobName.FromProjectLocationMigrationJob("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]");
     // Make the request
     MigrationJob response = dataMigrationServiceClient.GetMigrationJob(name);
 }
 /// <summary>Snippet for GetConnectionProfile</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetConnectionProfile()
 {
     // Create client
     DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/connectionProfiles/[CONNECTION_PROFILE]";
     // Make the request
     ConnectionProfile response = dataMigrationServiceClient.GetConnectionProfile(name);
 }
 /// <summary>Snippet for GetConnectionProfile</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetConnectionProfileResourceNames()
 {
     // Create client
     DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
     // Initialize request argument(s)
     ConnectionProfileName name = ConnectionProfileName.FromProjectLocationConnectionProfile("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]");
     // Make the request
     ConnectionProfile response = dataMigrationServiceClient.GetConnectionProfile(name);
 }
 /// <summary>Snippet for GetMigrationJob</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetMigrationJob()
 {
     // Create client
     DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/migrationJobs/[MIGRATION_JOB]";
     // Make the request
     MigrationJob response = dataMigrationServiceClient.GetMigrationJob(name);
 }
 /// <summary>Snippet for GetMigrationJob</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetMigrationJobRequestObject()
 {
     // Create client
     DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
     // Initialize request argument(s)
     GetMigrationJobRequest request = new GetMigrationJobRequest
     {
         MigrationJobName = MigrationJobName.FromProjectLocationMigrationJob("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"),
     };
     // Make the request
     MigrationJob response = dataMigrationServiceClient.GetMigrationJob(request);
 }
Example #13
0
 /// <summary>Snippet for GenerateSshScript</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GenerateSshScriptRequestObject()
 {
     // Create client
     DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
     // Initialize request argument(s)
     GenerateSshScriptRequest request = new GenerateSshScriptRequest
     {
         MigrationJobAsMigrationJobName = MigrationJobName.FromProjectLocationMigrationJob("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"),
         Vm               = "",
         VmPort           = 0,
         VmCreationConfig = new VmCreationConfig(),
     };
     // Make the request
     SshScript response = dataMigrationServiceClient.GenerateSshScript(request);
 }
Example #14
0
        /// <summary>Snippet for ListConnectionProfiles</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListConnectionProfilesRequestObject()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            ListConnectionProfilesRequest request = new ListConnectionProfilesRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Filter  = "",
                OrderBy = "",
            };
            // Make the request
            PagedEnumerable <ListConnectionProfilesResponse, ConnectionProfile> response = dataMigrationServiceClient.ListConnectionProfiles(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (ConnectionProfile 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 (ListConnectionProfilesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ConnectionProfile 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 <ConnectionProfile> 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 (ConnectionProfile 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;
        }
Example #15
0
        /// <summary>Snippet for ListMigrationJobs</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListMigrationJobs()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            string parent = "projects/[PROJECT]/locations/[LOCATION]";
            // Make the request
            PagedEnumerable <ListMigrationJobsResponse, MigrationJob> response = dataMigrationServiceClient.ListMigrationJobs(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (MigrationJob 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 (ListMigrationJobsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (MigrationJob 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 <MigrationJob> 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 (MigrationJob 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;
        }