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 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 Run(self, args): """Runs the command. Args: args: All the arguments that were provided to this command invocation. Returns: An iterator over objects containing connection profile data. """ cp_client = connection_profiles.ConnectionProfilesClient( self.ReleaseTrack()) project_id = properties.VALUES.core.project.Get(required=True) profiles = cp_client.List(project_id, args) return [_ConnectionProfileInfo(profile, self._GetHost(profile)) for profile in profiles]
def _GetUri(release_track, connection_profile_info): """Gets the resource URI for a connection profile.""" return connection_profiles.ConnectionProfilesClient(release_track).GetUri( connection_profile_info.name)