示例#1
0
    def Run(self, args):
        """Create a Database Migration Service migration job.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object representing the operations resource describing the create
      operation if the create was successful.
    """
        migration_job_ref = args.CONCEPTS.migration_job.Parse()
        parent_ref = migration_job_ref.Parent().RelativeName()

        source_ref = args.CONCEPTS.source.Parse()
        destination_ref = args.CONCEPTS.destination.Parse()

        cp_client = migration_jobs.MigrationJobsClient()
        result_operation = cp_client.Create(parent_ref,
                                            migration_job_ref.migrationJobsId,
                                            source_ref, destination_ref, args)

        client = api_util.GetClientInstance()
        messages = api_util.GetMessagesModule()
        resource_parser = api_util.GetResourceParser()

        operation_ref = resource_parser.Create(
            'datamigration.projects.locations.operations',
            operationsId=result_operation.name,
            projectsId=migration_job_ref.projectsId,
            locationsId=migration_job_ref.locationsId)

        return client.projects_locations_operations.Get(
            messages.DatamigrationProjectsLocationsOperationsGetRequest(
                name=operation_ref.operationsId))
    def Run(self, args):
        """Create a Database Migration Service connection profile for Cloud SQL.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object representing the operations resource describing the create
      operation if the create was successful.
    """
        connection_profile_ref = args.CONCEPTS.connection_profile.Parse()
        parent_ref = connection_profile_ref.Parent().RelativeName()

        cp_client = connection_profiles.ConnectionProfilesClient(
            self.ReleaseTrack())
        result_operation = cp_client.Create(
            parent_ref, connection_profile_ref.connectionProfilesId,
            'CLOUDSQL', args)

        client = api_util.GetClientInstance(self.ReleaseTrack())
        messages = api_util.GetMessagesModule(self.ReleaseTrack())
        resource_parser = api_util.GetResourceParser(self.ReleaseTrack())

        operation_ref = resource_parser.Create(
            'datamigration.projects.locations.operations',
            operationsId=result_operation.name,
            projectsId=connection_profile_ref.projectsId,
            locationsId=connection_profile_ref.locationsId)

        return client.projects_locations_operations.Get(
            messages.DatamigrationProjectsLocationsOperationsGetRequest(
                name=operation_ref.operationsId))
 def __init__(self, release_track):
     self._api_version = api_util.GetApiVersion(release_track)
     self.client = api_util.GetClientInstance(release_track)
     self.messages = api_util.GetMessagesModule(release_track)
     self._service = self.client.projects_locations_connectionProfiles
     self.resource_parser = api_util.GetResourceParser(release_track)
     self._release_track = release_track
示例#4
0
  def Run(self, args):
    """Update a Database Migration Service connection profiles.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object representing the operations resource describing the create
      operation if the create was successful.
    """
    connection_profile_ref = args.CONCEPTS.connection_profile.Parse()

    if args.prompt_for_password:
      args.password = getpass.getpass('Please Enter Password: '******'datamigration.projects.locations.operations',
        operationsId=result_operation.name,
        projectsId=connection_profile_ref.projectsId,
        locationsId=connection_profile_ref.locationsId)

    return client.projects_locations_operations.Get(
        messages.DatamigrationProjectsLocationsOperationsGetRequest(
            name=operation_ref.operationsId))
 def __init__(self, release_track):
     self.client = api_util.GetClientInstance(release_track)
     self.messages = api_util.GetMessagesModule(release_track)
     self._service = self.client.projects_locations_migrationJobs
     self.resource_parser = api_util.GetResourceParser(release_track)
示例#6
0
 def __init__(self, client=None, messages=None):
     self.client = client or api_util.GetClientInstance()
     self.messages = messages or api_util.GetMessagesModule()
     self._service = self.client.projects_locations_migrationJobs
     self.resource_parser = api_util.GetResourceParser()