Example #1
0
def GetServiceFromResourceType(resource_type):
    """Returns the service from the resource type input.

  Args:
    resource_type: A String object that contains the resource type
  """

    if resource_type == ORGANIZATION:
        service = settings_service.OrganizationsSettingsService()
    elif resource_type == FOLDER:
        service = settings_service.FoldersSettingsService()
    else:
        service = settings_service.ProjectsSettingsService()

    return service
Example #2
0
def GetServiceFromArgs(args):
    """Returns the service from the user-specified arguments.

  Args:
    args: argparse.Namespace, An object that contains the values for the
      arguments specified in the Args method.
  """

    if args.organization:
        service = settings_service.OrganizationsSettingsService()
    elif args.folder:
        service = settings_service.FoldersSettingsService()
    else:
        service = settings_service.ProjectsSettingsService()

    return service