Exemplo n.º 1
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Yields:
      Some value that we want to have printed later.
    """

        cli = util.GetAdminClient()
        # cluster_ref: A resource reference to the cluster to search for hottablets.
        cluster_ref = args.CONCEPTS.cluster.Parse()

        # Create a ListHotTablets Request and send through Admin Client.
        msg = (util.GetAdminMessages(
        ).BigtableadminProjectsInstancesClustersHotTabletsListRequest(
            parent=cluster_ref.RelativeName(),
            startTime=args.start_time
            and times.FormatDateTime(args.start_time),
            endTime=args.end_time and times.FormatDateTime(args.end_time)))

        for hot_tablet in list_pager.YieldFromList(
                cli.projects_instances_clusters_hotTablets,
                msg,
                field='hotTablets',
                batch_size_attribute=None):
            yield hot_tablet
Exemplo n.º 2
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        msgs = util.GetAdminMessages()
        for instance in args.instance:
            should_continue = console_io.PromptContinue(
                message='Delete instance {}. Are you sure?'.format(instance))

            if should_continue:
                ref = resources.REGISTRY.Parse(
                    instance,
                    params={
                        'projectsId': properties.VALUES.core.project.GetOrFail,
                    },
                    collection='bigtableadmin.projects.instances')
                msg = msgs.BigtableadminProjectsInstancesDeleteRequest(
                    name=ref.RelativeName())
                cli.projects_instances.Delete(msg)
        return None
Exemplo n.º 3
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Yields:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        instance_ref = args.CONCEPTS.instance.Parse()
        cluster_ref = args.CONCEPTS.cluster.Parse()

        if cluster_ref:
            cluster_str = cluster_ref.RelativeName()
        elif instance_ref:
            if args.IsSpecified('cluster'):
                cluster_str = instance_ref.RelativeName(
                ) + '/clusters/' + args.cluster
            else:
                cluster_str = instance_ref.RelativeName() + '/clusters/-'
        else:
            raise exceptions.InvalidArgumentException(
                '--instance', '--instance must be specified')
        msg = (util.GetAdminMessages().
               BigtableadminProjectsInstancesClustersBackupsListRequest(
                   parent=cluster_str))
        for backup in list_pager.YieldFromList(
                cli.projects_instances_clusters_backups,
                msg,
                field='backups',
                batch_size_attribute=None):
            yield backup
Exemplo n.º 4
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        ref = resources.REGISTRY.Parse(
            args.instance, collection='bigtableadmin.projects.instances')
        msg = util.GetAdminMessages().BigtableadminProjectsInstancesGetRequest(
            projectsId=ref.projectsId, instancesId=ref.Name())
        instance = cli.projects_instances.Get(msg)
        instance.state = None  # must be unset when calling Update
        if args.description:
            instance.displayName = args.description
        msg = util.GetAdminMessages(
        ).BigtableadminProjectsInstancesUpdateRequest(
            projectsId=ref.projectsId,
            instancesId=ref.Name(),
            instance=instance)
        instance = cli.projects_instances.Update(msg)
        log.UpdatedResource(instance.name, kind='instance')
        return instance
Exemplo n.º 5
0
    def Run(self, args):
        cli = util.GetAdminClient()
        msgs = util.GetAdminMessages()

        instances = args.instances
        results = []
        for instance in instances:
            instance_ref = resources.REGISTRY.Parse(
                instance,
                params={
                    'projectsId': properties.VALUES.core.project.GetOrFail
                },
                collection='bigtableadmin.projects.instances')

            request = msgs.BigtableadminProjectsInstancesTablesListRequest(
                parent=instance_ref.RelativeName(), )

            for table in list_pager.YieldFromList(
                    cli.projects_instances_tables,
                    request,
                    field='tables',
                    batch_size_attribute=None):
                results.append(table)

        return results
Exemplo n.º 6
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Yields:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        instances = args.instances or ['-']
        for instance in instances:
            ref = resources.REGISTRY.Parse(
                instance,
                params={
                    'projectsId': properties.VALUES.core.project.GetOrFail,
                },
                collection='bigtableadmin.projects.instances')
            msg = (util.GetAdminMessages().
                   BigtableadminProjectsInstancesClustersListRequest(
                       parent=ref.RelativeName()))
            for cluster in list_pager.YieldFromList(
                    cli.projects_instances_clusters,
                    msg,
                    field='clusters',
                    batch_size_attribute=None):
                yield cluster
Exemplo n.º 7
0
  def Run(self, args):
    """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Yields:
      Some value that we want to have printed later.
    """
    cli = util.GetAdminClient()
    instance_refs = args.CONCEPTS.instances.Parse()
    if not args.IsSpecified('instances'):
      instance_refs = [util.GetInstanceRef('-')]
    for instance_ref in instance_refs:
      msg = (
          util.GetAdminMessages()
          .BigtableadminProjectsInstancesClustersListRequest(
              parent=instance_ref.RelativeName()))
      for cluster in list_pager.YieldFromList(
          cli.projects_instances_clusters,
          msg,
          field='clusters',
          batch_size_attribute=None):
        yield cluster
Exemplo n.º 8
0
  def Run(self, args):
    """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
    cli = util.GetAdminClient()
    msgs = util.GetAdminMessages()
    ref = resources.REGISTRY.Parse(
        args.cluster,
        params={'instancesId': args.instance},
        collection='bigtableadmin.projects.instances.clusters')
    msg = msgs.BigtableadminProjectsInstancesClustersUpdateRequest(
        projectsId=ref.projectsId,
        instancesId=ref.instancesId,
        clustersId=ref.Name(),
        cluster=msgs.Cluster(name=ref.Name(),
                             serveNodes=args.num_nodes))
    result = cli.projects_instances_clusters.Update(msg)
    if not args.async:
      # TODO(user): enable this line when b/29563942 is fixed in apitools
      pass
      # util.WaitForOpV2(result, 'Updating cluster')
    log.UpdatedResource(args.cluster, kind='cluster', async=args.async)
Exemplo n.º 9
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        ref_name = 'operations/' + resources.REGISTRY.Parse(
            properties.VALUES.core.project.Get(required=True),
            collection='bigtableadmin.projects').RelativeName()

        if args.IsSpecified('instance'):
            ref_name = ref_name + '/instances/' + args.instance

        msg = (util.GetAdminMessages(
        ).BigtableadminOperationsProjectsOperationsListRequest(name=ref_name))

        return list_pager.YieldFromList(cli.operations_projects_operations,
                                        msg,
                                        field='operations',
                                        batch_size_attribute=None)
Exemplo n.º 10
0
def GetIamPolicy(instance_ref):
    """Get IAM policy for a given instance."""
    client = util.GetAdminClient()
    msgs = util.GetAdminMessages()
    req = msgs.BigtableadminProjectsInstancesGetIamPolicyRequest(
        resource=instance_ref.RelativeName())
    return client.projects_instances.GetIamPolicy(req)
Exemplo n.º 11
0
def Create(cluster_ref, zone, serve_nodes=3):
  """Create a cluster.

  Args:
    cluster_ref: A resource reference to the cluster to create.
    zone: string, The zone this cluster should be inside.
    serve_nodes: int, The number of nodes in this cluster.

  Returns:
    Long running operation.
  """
  client = util.GetAdminClient()
  msgs = util.GetAdminMessages()

  storage_type = (
      msgs.Cluster.DefaultStorageTypeValueValuesEnum.STORAGE_TYPE_UNSPECIFIED)

  cluster_msg = msgs.Cluster(
      serveNodes=serve_nodes,
      location=util.LocationUrl(zone),
      defaultStorageType=storage_type)

  msg = msgs.BigtableadminProjectsInstancesClustersCreateRequest(
      cluster=cluster_msg,
      clusterId=cluster_ref.Name(),
      parent=cluster_ref.Parent().RelativeName())
  return client.projects_instances_clusters.Create(msg)
Exemplo n.º 12
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = bigtable_util.GetAdminClient()
        ref = resources.REGISTRY.Parse(
            args.instance,
            params={
                'projectsId': properties.VALUES.core.project.GetOrFail,
            },
            collection='bigtableadmin.projects.instances')
        msgs = bigtable_util.GetAdminMessages()
        instance = cli.projects_instances.Get(
            msgs.BigtableadminProjectsInstancesGetRequest(
                name=ref.RelativeName()))
        instance.state = None  # must be unset when calling Update
        if args.description:
            instance.displayName = args.description
        if args.instance_type:
            instance.type = msgs.Instance.TypeValueValuesEnum(
                args.instance_type)
        instance = cli.projects_instances.Update(instance)
        log.UpdatedResource(instance.name, kind='instance')
        return instance
Exemplo n.º 13
0
def SetPolicy(instance_ref, policy):
    """Sets the given policy on the instance, overwriting what exists."""
    client = util.GetAdminClient()
    msgs = util.GetAdminMessages()
    req = msgs.BigtableadminProjectsInstancesSetIamPolicyRequest(
        resource=instance_ref.RelativeName(),
        setIamPolicyRequest=msgs.SetIamPolicyRequest(policy=policy))
    return client.projects_instances.SetIamPolicy(req)
Exemplo n.º 14
0
def SetIamPolicy(instance_ref, policy):
    """Sets the given policy on the instance, overwriting what exists."""
    client = util.GetAdminClient()
    msgs = util.GetAdminMessages()
    policy.version = iam_util.MAX_LIBRARY_IAM_SUPPORTED_VERSION
    req = msgs.BigtableadminProjectsInstancesSetIamPolicyRequest(
        resource=instance_ref.RelativeName(),
        setIamPolicyRequest=msgs.SetIamPolicyRequest(policy=policy))
    return client.projects_instances.SetIamPolicy(req)
Exemplo n.º 15
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        # TODO(b/73365914) remove after deprecation period
        display_name = args.display_name or args.description

        cli = bigtable_util.GetAdminClient()
        ref = resources.REGISTRY.Parse(
            args.instance,
            params={
                'projectsId': properties.VALUES.core.project.GetOrFail,
            },
            collection='bigtableadmin.projects.instances')
        parent_ref = resources.REGISTRY.Create('bigtableadmin.projects',
                                               projectId=ref.projectsId)
        msgs = bigtable_util.GetAdminMessages()
        msg = msgs.CreateInstanceRequest(
            instanceId=ref.Name(),
            parent=parent_ref.RelativeName(),
            instance=msgs.Instance(
                # TODO(b/73365914) replace with args.display_name after deprecation
                displayName=display_name,
                type=msgs.Instance.TypeValueValuesEnum(args.instance_type)),
            clusters=msgs.CreateInstanceRequest.
            ClustersValue(additionalProperties=[
                msgs.CreateInstanceRequest.ClustersValue.AdditionalProperty(
                    key=args.cluster,
                    value=msgs.Cluster(
                        serveNodes=args.cluster_num_nodes,
                        defaultStorageType=(
                            msgs.Cluster.DefaultStorageTypeValueValuesEnum(
                                args.cluster_storage_type.upper())),
                        # TODO(b/36056455): switch location to resource
                        # when b/29566669 is fixed on API
                        location=bigtable_util.LocationUrl(args.cluster_zone)))
            ]))
        result = cli.projects_instances.Create(msg)
        operation_ref = resources.REGISTRY.ParseRelativeName(
            result.name, 'bigtableadmin.operations')

        if args. async:
            log.CreatedResource(operation_ref,
                                kind='bigtable instance {0}'.format(
                                    ref.Name()),
                                async=True)
            return result

        return bigtable_util.WaitForInstance(
            cli, operation_ref,
            'Creating bigtable instance {0}'.format(ref.Name()))
Exemplo n.º 16
0
def GetIamPolicy(instance_ref):
    """Get IAM policy for a given instance."""
    client = util.GetAdminClient()
    msgs = util.GetAdminMessages()
    req = msgs.BigtableadminProjectsInstancesGetIamPolicyRequest(
        resource=instance_ref.RelativeName(),
        getIamPolicyRequest=msgs.GetIamPolicyRequest(
            options=msgs.GetPolicyOptions(requestedPolicyVersion=iam_util.
                                          MAX_LIBRARY_IAM_SUPPORTED_VERSION)))
    return client.projects_instances.GetIamPolicy(req)
Exemplo n.º 17
0
def Delete(cluster_ref):
  """Delete a cluster.

  Args:
    cluster_ref: A resource reference to the cluster to delete.
  """
  client = util.GetAdminClient()
  msgs = util.GetAdminMessages()
  msg = msgs.BigtableadminProjectsInstancesClustersDeleteRequest(
      name=cluster_ref.RelativeName())
  client.projects_instances_clusters.Delete(msg)
Exemplo n.º 18
0
def Update(app_profile_ref,
           cluster=None,
           description='',
           multi_cluster=False,
           transactional_writes=False,
           force=False):
    """Update an app profile.

  Args:
    app_profile_ref: A resource reference of the app profile to update.
    cluster: string, The cluster id for the app profile to route to using
        single cluster routing.
    description: string, A description of the app profile.
    multi_cluster: bool, Whether this app profile should route to multiple
        clusters, instead of single cluster.
    transactional_writes: bool, Whether this app profile has transactional
        writes enabled. This is only possible when using single cluster routing.
    force: bool, Whether to ignore API warnings and create forcibly.

  Raises:
    ValueError: Cannot specify both cluster and multi_cluster.

  Returns:
    Long running operation.
  """
    if cluster and multi_cluster:
        raise ValueError('Cannot update both --route-to and --route-any')

    client = util.GetAdminClient()
    msgs = util.GetAdminMessages()

    changed_fields = []
    app_profile = msgs.AppProfile()

    if cluster:
        changed_fields.append('singleClusterRouting')
        app_profile.singleClusterRouting = msgs.SingleClusterRouting(
            clusterId=cluster, allowTransactionalWrites=transactional_writes)
    elif multi_cluster:
        changed_fields.append('multiClusterRoutingUseAny')
        app_profile.multiClusterRoutingUseAny = msgs.MultiClusterRoutingUseAny(
        )

    if description:
        changed_fields.append('description')
        app_profile.description = description

    msg = msgs.BigtableadminProjectsInstancesAppProfilesPatchRequest(
        appProfile=app_profile,
        name=app_profile_ref.RelativeName(),
        updateMask=','.join(changed_fields),
        ignoreWarnings=force)
    return client.projects_instances_appProfiles.Patch(msg)
def CopyBackup(source_backup_ref, destination_backup_ref, args):
    """Copy a backup."""
    client = util.GetAdminClient()
    msgs = util.GetAdminMessages()
    copy_backup_request = msgs.CopyBackupRequest(
        backupId=destination_backup_ref.Name(),
        sourceBackup=source_backup_ref.RelativeName())
    copy_backup_request.expireTime = GetExpireTime(args)

    req = msgs.BigtableadminProjectsInstancesClustersBackupsCopyRequest(
        parent=destination_backup_ref.Parent().RelativeName(),
        copyBackupRequest=copy_backup_request)
    return client.projects_instances_clusters_backups.Copy(req)
Exemplo n.º 20
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = bigtable_util.GetAdminClient()
        ref = bigtable_util.GetInstanceRef(args.instance)
        parent_ref = resources.REGISTRY.Create('bigtableadmin.projects',
                                               projectId=ref.projectsId)
        msgs = bigtable_util.GetAdminMessages()

        instance_type = msgs.Instance.TypeValueValuesEnum(args.instance_type)
        num_nodes = arguments.ProcessInstanceTypeAndNodes(args, instance_type)

        msg = msgs.CreateInstanceRequest(
            instanceId=ref.Name(),
            parent=parent_ref.RelativeName(),
            instance=msgs.Instance(displayName=args.display_name,
                                   type=msgs.Instance.TypeValueValuesEnum(
                                       args.instance_type)),
            clusters=msgs.CreateInstanceRequest.
            ClustersValue(additionalProperties=[
                msgs.CreateInstanceRequest.ClustersValue.AdditionalProperty(
                    key=args.cluster,
                    value=msgs.Cluster(
                        serveNodes=num_nodes,
                        defaultStorageType=(
                            msgs.Cluster.DefaultStorageTypeValueValuesEnum(
                                args.cluster_storage_type.upper())),
                        # TODO(b/36056455): switch location to resource
                        # when b/29566669 is fixed on API
                        location=bigtable_util.LocationUrl(args.cluster_zone)))
            ]))
        result = cli.projects_instances.Create(msg)
        operation_ref = bigtable_util.GetOperationRef(result)

        if args.async_:
            log.CreatedResource(operation_ref,
                                kind='bigtable instance {0}'.format(
                                    ref.Name()),
                                is_async=True)
            return result

        return bigtable_util.AwaitInstance(
            operation_ref, 'Creating bigtable instance {0}'.format(ref.Name()))
Exemplo n.º 21
0
def Describe(app_profile_ref):
    """Describe an app profile.

  Args:
    app_profile_ref: A resource reference to the app profile to describe.

  Returns:
    App profile resource object.
  """
    client = util.GetAdminClient()
    msg = (util.GetAdminMessages().
           BigtableadminProjectsInstancesAppProfilesGetRequest(
               name=app_profile_ref.RelativeName()))
    return client.projects_instances_appProfiles.Get(msg)
Exemplo n.º 22
0
def Update(cluster_ref, serve_nodes):
  """Update a cluster.

  Args:
    cluster_ref: A resource reference to the cluster to update.
    serve_nodes: int, The number of nodes in this cluster.

  Returns:
    Long running operation.
  """
  client = util.GetAdminClient()
  msgs = util.GetAdminMessages()
  msg = msgs.Cluster(name=cluster_ref.RelativeName(), serveNodes=serve_nodes)
  return client.projects_instances_clusters.Update(msg)
Exemplo n.º 23
0
def Create(app_profile_ref,
           cluster=None,
           description='',
           multi_cluster=False,
           transactional_writes=False,
           force=False):
  """Create an app profile.

  Args:
    app_profile_ref: A resource reference of the new app profile.
    cluster: string, The cluster id for the new app profile to route to using
        single cluster routing.
    description: string, A description of the app profile.
    multi_cluster: bool, Whether this app profile should route to multiple
        clusters, instead of single cluster.
    transactional_writes: bool, Whether this app profile has transactional
        writes enabled. This is only possible when using single cluster routing.
    force: bool, Whether to ignore API warnings and create forcibly.

  Raises:
    ValueError: Cannot specify both cluster and multi_cluster.

  Returns:
    Created app profile resource object.
  """
  if (multi_cluster and cluster) or not (multi_cluster or cluster):
    raise ValueError('Must specify either --route-to or --route-any')

  client = util.GetAdminClient()
  msgs = util.GetAdminMessages()

  instance_ref = app_profile_ref.Parent()

  multi_cluster_routing = None
  single_cluster_routing = None
  if multi_cluster:
    multi_cluster_routing = msgs.MultiClusterRoutingUseAny()
  elif cluster:
    single_cluster_routing = msgs.SingleClusterRouting(
        clusterId=cluster, allowTransactionalWrites=transactional_writes)

  msg = msgs.BigtableadminProjectsInstancesAppProfilesCreateRequest(
      appProfile=msgs.AppProfile(
          description=description,
          multiClusterRoutingUseAny=multi_cluster_routing,
          singleClusterRouting=single_cluster_routing),
      appProfileId=app_profile_ref.Name(),
      parent=instance_ref.RelativeName(),
      ignoreWarnings=force)
  return client.projects_instances_appProfiles.Create(msg)
Exemplo n.º 24
0
  def Run(self, args):
    """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
    cli = util.GetAdminClient()
    msg = util.GetAdminMessages().BigtableadminProjectsInstancesListRequest(
        projectsId=properties.VALUES.core.project.Get())
    instances = cli.projects_instances.List(msg).instances
    return instances
Exemplo n.º 25
0
def Delete(app_profile_ref, force=False):
    """Delete an app profile.

  Args:
    app_profile_ref: A resource reference to the app profile to delete.
    force: bool, Whether to ignore API warnings and delete
        forcibly.

  Returns:
    Empty response.
  """
    client = util.GetAdminClient()
    msg = (util.GetAdminMessages().
           BigtableadminProjectsInstancesAppProfilesDeleteRequest(
               name=app_profile_ref.RelativeName(), ignoreWarnings=force))
    return client.projects_instances_appProfiles.Delete(msg)
Exemplo n.º 26
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        cluster_ref = args.CONCEPTS.cluster.Parse()
        msg = util.GetAdminMessages(
        ).BigtableadminProjectsInstancesClustersGetRequest(
            name=cluster_ref.RelativeName())
        return cli.projects_instances_clusters.Get(msg)
Exemplo n.º 27
0
def Create(cluster_ref, cluster):
    """Create a cluster.

  Args:
    cluster_ref: A resource reference to the cluster to create.
    cluster: A Cluster msg object to create.

  Returns:
    Long running operation.
  """
    client = util.GetAdminClient()
    msgs = util.GetAdminMessages()
    msg = msgs.BigtableadminProjectsInstancesClustersCreateRequest(
        cluster=cluster,
        clusterId=cluster_ref.Name(),
        parent=cluster_ref.Parent().RelativeName())
    return client.projects_instances_clusters.Create(msg)
Exemplo n.º 28
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        ref = resources.REGISTRY.Parse(
            args.instance, collection='bigtableadmin.projects.instances')
        msg = util.GetAdminMessages().BigtableadminProjectsInstancesGetRequest(
            projectsId=ref.projectsId, instancesId=ref.Name())
        instance = cli.projects_instances.Get(msg)
        return instance
Exemplo n.º 29
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        cli = util.GetAdminClient()
        msg = util.GetAdminMessages(
        ).BigtableadminProjectsInstancesListRequest(
            projectsId=properties.VALUES.core.project.Get())
        return list_pager.YieldFromList(cli.projects_instances,
                                        msg,
                                        field='instances',
                                        batch_size_attribute=None)
Exemplo n.º 30
0
def List(instance_ref):
    """List app profiles.

  Args:
    instance_ref: A resource reference of the instance to list
                  app profiles for.

  Returns:
    Generator of app profile resource objects.
  """
    client = util.GetAdminClient()
    msg = (util.GetAdminMessages().
           BigtableadminProjectsInstancesAppProfilesListRequest(
               parent=instance_ref.RelativeName()))
    return list_pager.YieldFromList(client.projects_instances_appProfiles,
                                    msg,
                                    field='appProfiles',
                                    batch_size_attribute=None)