コード例 #1
0
def GetParentFromArgs(args):
  """Returns the relative path to the parent from args.

  Args:
    args: command line args.

  Returns:
    The relative path. e.g. 'projects/foo', 'folders/1234'.
  """
  if args.organization:
    org_ref = resources.REGISTRY.Parse(
        args.organization,
        collection='cloudresourcemanager.organizations')
    return org_ref.RelativeName()
  elif args.folder:
    folder_ref = folders.FoldersRegistry().Parse(
        args.folder,
        collection='cloudresourcemanager.folders')
    return folder_ref.RelativeName()
  elif args.billing_account:
    billing_account_ref = resources.REGISTRY.Parse(
        args.billing_account,
        collection='cloudbilling.billingAccounts')
    return billing_account_ref.RelativeName()
  else:
    return GetCurrentProjectParent()
コード例 #2
0
ファイル: util.py プロジェクト: hiroshiyoshida1980/jpopjam
def GetParentResourceFromArgs(args):
  """Returns the parent resource derived from the given args.

  Args:
    args: command line args.

  Returns:
    The parent resource.
  """
  if args.organization:
    return resources.REGISTRY.Parse(
        args.organization,
        collection='cloudresourcemanager.organizations')
  elif args.folder:
    return folders.FoldersRegistry().Parse(
        args.folder,
        collection='cloudresourcemanager.folders')
  elif args.billing_account:
    return resources.REGISTRY.Parse(
        args.billing_account,
        collection='cloudbilling.billingAccounts')
  else:
    return resources.REGISTRY.Parse(
        properties.VALUES.core.project.Get(required=True),
        collection='cloudresourcemanager.projects')
コード例 #3
0
ファイル: util.py プロジェクト: Dhauzur/access-control
def GetFolderResource(folder):
  """Returns the resource for the folder.

  Args:
    folder: folder.

  Returns:
    The resource.
  """
  return folders.FoldersRegistry().Parse(
      folder, collection='cloudresourcemanager.folders')
コード例 #4
0
ファイル: folders_base.py プロジェクト: AlexisMarie8330/Doll
 def GetFolderRef(self, folder_id):
     return folders.FoldersRegistry().Parse(None,
                                            params={'foldersId': folder_id},
                                            collection=self.Collection())