/// <summary>Snippet for DeleteMigrationJob</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteMigrationJobResourceNames()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            MigrationJobName name = MigrationJobName.FromProjectLocationMigrationJob("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]");
            // Make the request
            Operation <Empty, OperationMetadata> response = dataMigrationServiceClient.DeleteMigrationJob(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.PollOnceDeleteMigrationJob(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 ResumeMigrationJobAsync</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 ResumeMigrationJobRequestObjectAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            ResumeMigrationJobRequest request = new ResumeMigrationJobRequest
            {
                MigrationJobName = MigrationJobName.FromProjectLocationMigrationJob("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"),
            };
            // Make the request
            Operation <MigrationJob, OperationMetadata> response = await dataMigrationServiceClient.ResumeMigrationJobAsync(request);

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

            // 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 = await dataMigrationServiceClient.PollOnceResumeMigrationJobAsync(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 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 CreateMigrationJobRequestObject()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = DataMigrationServiceClient.Create();
            // Initialize request argument(s)
            CreateMigrationJobRequest request = new CreateMigrationJobRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                MigrationJobId       = "",
                MigrationJob         = new MigrationJob(),
                RequestId            = "",
            };
            // Make the request
            Operation <MigrationJob, OperationMetadata> response = dataMigrationServiceClient.CreateMigrationJob(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.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;
            }
        }
Exemplo n.º 4
0
        /// <summary>Snippet for CreateConnectionProfileAsync</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 CreateConnectionProfileRequestObjectAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateConnectionProfileRequest request = new CreateConnectionProfileRequest
            {
                ParentAsConnectionProfileName = ConnectionProfileName.FromProjectLocationConnectionProfile("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"),
                ConnectionProfileId           = "",
                ConnectionProfile             = new ConnectionProfile(),
                RequestId = "",
            };
            // Make the request
            Operation <ConnectionProfile, OperationMetadata> response = await dataMigrationServiceClient.CreateConnectionProfileAsync(request);

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

            // 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 = await dataMigrationServiceClient.PollOnceCreateConnectionProfileAsync(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;
            }
        }
Exemplo n.º 5
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 DeleteConnectionProfileAsync</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 DeleteConnectionProfileAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/connectionProfiles/[CONNECTION_PROFILE]";
            // Make the request
            Operation <Empty, OperationMetadata> response = await dataMigrationServiceClient.DeleteConnectionProfileAsync(name);

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

            // 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 = await dataMigrationServiceClient.PollOnceDeleteConnectionProfileAsync(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 CreateMigrationJobAsync</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 CreateMigrationJobResourceNamesAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            LocationName parent         = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
            MigrationJob migrationJob   = new MigrationJob();
            string       migrationJobId = "";
            // Make the request
            Operation <MigrationJob, OperationMetadata> response = await dataMigrationServiceClient.CreateMigrationJobAsync(parent, migrationJob, migrationJobId);

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

            // 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 = await dataMigrationServiceClient.PollOnceCreateMigrationJobAsync(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;
            }
        }
Exemplo n.º 8
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 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;
            }
        }
Exemplo n.º 10
0
        /// <summary>Snippet for UpdateMigrationJobAsync</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 UpdateMigrationJobAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            MigrationJob migrationJob = new MigrationJob();
            FieldMask    updateMask   = new FieldMask();
            // Make the request
            Operation <MigrationJob, OperationMetadata> response = await dataMigrationServiceClient.UpdateMigrationJobAsync(migrationJob, updateMask);

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

            // 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 = await dataMigrationServiceClient.PollOnceUpdateMigrationJobAsync(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 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;
            }
        }
Exemplo n.º 12
0
        private ProjectTask CreateDMSSqlTask(MockContext context,
                                             DataMigrationServiceClient client,
                                             ResourceGroup resourceGroup,
                                             DataMigrationService service,
                                             string dmsProjectName,
                                             string dmsTaskName)
        {
            var taskProps = new ConnectToTargetSqlDbTaskProperties
            {
                Input = new ConnectToTargetSqlDbTaskInput(
                    new SqlConnectionInfo
                {
                    DataSource             = "shuhuandmsdbs.database.windows.net",
                    EncryptConnection      = true,
                    TrustServerCertificate = true,
                    UserName       = "******",
                    Password       = "******",
                    Authentication = AuthenticationType.SqlAuthentication,
                }
                    )
            };

            return(client.Tasks.CreateOrUpdate(
                       new ProjectTask(
                           properties: taskProps),
                       resourceGroup.Name,
                       service.Name,
                       dmsProjectName,
                       dmsTaskName));
        }
Exemplo n.º 13
0
        private DataMigrationServiceClient GetDmsClient(MockContext context)
        {
            DataMigrationServiceClient client = context.GetServiceClient <DataMigrationServiceClient>(Rest.ClientRuntime.Azure.TestFramework.TestEnvironmentFactory.GetTestEnvironment());

            client.LongRunningOperationRetryTimeout = DefaultTimeOut;

            return(client);
        }
 /// <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);
 }
Exemplo n.º 17
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);
 }
Exemplo n.º 18
0
 protected Project CreateDMSProject(MockContext context,
                                    DataMigrationServiceClient client,
                                    ResourceGroup resourceGroup,
                                    string dmsInstanceName,
                                    string dmsProjectName)
 {
     return(client.Projects.CreateOrUpdate(
                new Project(TestConfiguration.Location, ProjectSourcePlatform.SQL, ProjectTargetPlatform.SQLDB),
                resourceGroup.Name,
                dmsInstanceName,
                dmsProjectName));
 }
 /// <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);
 }
Exemplo n.º 20
0
 protected DataMigrationService CreateDMSInstance(MockContext context,
                                                  DataMigrationServiceClient client,
                                                  ResourceGroup resourceGroup,
                                                  string dmsInstanceName)
 {
     return(client.Services.CreateOrUpdate(new DataMigrationService(
                                               type: "Microsoft.DataMigration/services",
                                               location: resourceGroup.Location,
                                               virtualSubnetId: TestConfiguration.VirtualSubnetId,
                                               sku: new ServiceSku("BusinessCritical_4vCores", "Business Critical")),
                                           resourceGroup.Name,
                                           dmsInstanceName));
 }
        /// <summary>Snippet for GetConnectionProfileAsync</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 GetConnectionProfileRequestObjectAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetConnectionProfileRequest request = new GetConnectionProfileRequest
            {
                ConnectionProfileName = ConnectionProfileName.FromProjectLocationConnectionProfile("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"),
            };
            // Make the request
            ConnectionProfile response = await dataMigrationServiceClient.GetConnectionProfileAsync(request);
        }
Exemplo n.º 22
0
        private ProjectTask CreateDMSSyncTask(MockContext context,
                                              DataMigrationServiceClient client,
                                              ResourceGroup resourceGroup,
                                              DataMigrationService service,
                                              string dmsProjectName,
                                              string dmsTaskName)
        {
            var taskProps = new MigrateSqlServerSqlDbSyncTaskProperties
            {
                Input = new MigrateSqlServerSqlDbSyncTaskInput(
                    new SqlConnectionInfo
                {
                    DataSource             = @"steven-work.redmond.corp.microsoft.com\stevenf16,12345",
                    EncryptConnection      = true,
                    TrustServerCertificate = true,
                    UserName       = "******",
                    Password       = "******",
                    Authentication = AuthenticationType.SqlAuthentication,
                },
                    new SqlConnectionInfo
                {
                    DataSource             = "shuhuandmsdbs.database.windows.net",
                    EncryptConnection      = true,
                    TrustServerCertificate = true,
                    UserName       = "******",
                    Password       = "******",
                    Authentication = AuthenticationType.SqlAuthentication,
                },
                    new List <MigrateSqlServerSqlDbSyncDatabaseInput>
                {
                    new MigrateSqlServerSqlDbSyncDatabaseInput
                    {
                        Name = "JasmineTest",
                        TargetDatabaseName = "JasmineTest",
                        TableMap           = new Dictionary <string, string> {
                            { "dbo.TestTable1", "dbo.TestTable1" }, { "dbo.TestTable2", "dbo.TestTable2" }
                        }
                    }
                })
            };

            return(client.Tasks.CreateOrUpdate(
                       new ProjectTask(
                           properties: taskProps),
                       resourceGroup.Name,
                       service.Name,
                       dmsProjectName,
                       dmsTaskName));
        }
Exemplo n.º 23
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);
 }
Exemplo n.º 24
0
        /// <summary>Snippet for ListMigrationJobsAsync</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 ListMigrationJobsRequestObjectAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListMigrationJobsRequest request = new ListMigrationJobsRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Filter  = "",
                OrderBy = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListMigrationJobsResponse, MigrationJob> response = dataMigrationServiceClient.ListMigrationJobsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((MigrationJob 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((ListMigrationJobsResponse page) =>
            {
                // 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 = 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 (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;
        }
Exemplo n.º 25
0
        private ProjectTask CreateDMSPGSyncTask(MockContext context,
                                                DataMigrationServiceClient client,
                                                ResourceGroup resourceGroup,
                                                DataMigrationService service,
                                                string dmsProjectName,
                                                string dmsTaskName)
        {
            var taskProps = new MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties
            {
                Input = new MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput(
                    new List <MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput>
                {
                    new MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput
                    {
                        Name = "someSourceDatabaseName",
                        TargetDatabaseName = "someTargetDatabaseName",
                        SelectedTables     = new List <MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseTableInput>
                        {
                            new MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseTableInput("public.someTableName")
                        }
                    }
                },
                    new PostgreSqlConnectionInfo
                {
                    ServerName             = @"someTargetServerName",
                    EncryptConnection      = true,
                    TrustServerCertificate = true,
                    UserName = "******",
                    Password = "******"
                },
                    new PostgreSqlConnectionInfo
                {
                    ServerName             = @"someSourceServerName",
                    EncryptConnection      = true,
                    TrustServerCertificate = true,
                    UserName = "******",
                    Password = "******"
                })
            };

            return(client.Tasks.CreateOrUpdate(
                       new ProjectTask(
                           properties: taskProps),
                       resourceGroup.Name,
                       service.Name,
                       dmsProjectName,
                       dmsTaskName));
        }
Exemplo n.º 26
0
        public static DataMigrationServiceClient GetDataMigrationManagementClient(MockContext context, RecordedDelegatingHandler handler)
        {
            DataMigrationServiceClient dmClient;

            if (IsTestTenant)
            {
                dmClient = new DataMigrationServiceClient(new TokenCredentials("xyz"), GetHandler());
                dmClient.SubscriptionId = testSubscription;
                dmClient.BaseUri        = testUri;
            }
            else
            {
                handler.IsPassThrough = true;
                dmClient = context.GetServiceClient <DataMigrationServiceClient>(handlers: handler);
            }
            return(dmClient);
        }
        /// <summary>Snippet for ListConnectionProfilesAsync</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 ListConnectionProfilesAsync()
        {
            // Create client
            DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]/locations/[LOCATION]";
            // Make the request
            PagedAsyncEnumerable <ListConnectionProfilesResponse, ConnectionProfile> response = dataMigrationServiceClient.ListConnectionProfilesAsync(parent);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((ConnectionProfile 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((ListConnectionProfilesResponse page) =>
            {
                // 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 = 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 (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;
        }
Exemplo n.º 28
0
        private ProjectTask CreateDMSSqlSyncTask(MockContext context,
                                                 DataMigrationServiceClient client,
                                                 ResourceGroup resourceGroup,
                                                 DataMigrationService service,
                                                 string dmsProjectName,
                                                 string dmsTaskName)
        {
            var taskProps = new MigrateSqlServerSqlDbSyncTaskProperties
            {
                Input = new MigrateSqlServerSqlDbSyncTaskInput(
                    new SqlConnectionInfo
                {
                    DataSource = @"someSourceServerName",
                    UserName   = "******",
                    Password   = "******"
                },
                    new SqlConnectionInfo
                {
                    DataSource = @"someTargetServerName",
                    UserName   = "******",
                    Password   = "******"
                },
                    new List <MigrateSqlServerSqlDbSyncDatabaseInput>
                {
                    new MigrateSqlServerSqlDbSyncDatabaseInput
                    {
                        Name = "someSourceDatabaseName",
                        TargetDatabaseName = "someTargetDatabaseName",
                        TableMap           = new Dictionary <string, string> {
                            { "someTableSource", "someTableSource" }
                        }
                    }
                })
            };

            return(client.Tasks.CreateOrUpdate(
                       new ProjectTask(
                           properties: taskProps),
                       resourceGroup.Name,
                       service.Name,
                       dmsProjectName,
                       dmsTaskName));
        }
Exemplo n.º 29
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;
        }
        private ProjectFile CreateDMSFile(MockContext context,
                                          DataMigrationServiceClient client,
                                          ResourceGroup resourceGroup,
                                          DataMigrationService service,
                                          string dmsProjectName,
                                          string dmsFileName)
        {
            var fileProps = new ProjectFileProperties
            {
                FilePath = "NorthWind.sql"
            };

            return(client.Files.CreateOrUpdate(
                       new ProjectFile {
                Properties = fileProps
            },
                       resourceGroup.Name,
                       service.Name,
                       dmsProjectName,
                       dmsFileName));
        }