コード例 #1
0
    def Run(self, args):
        """Run 'type-providers create'.

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

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
        messages = dm_beta_base.GetMessages()
        type_provider_ref = dm_beta_base.GetResources().Parse(
            args.provider_name, collection='deploymentmanager.typeProviders')
        update_labels_dict = labels_util.GetUpdateLabelsDictFromArgs(args)
        labels = dm_labels.UpdateLabels([],
                                        messages.TypeProviderLabelEntry,
                                        update_labels=update_labels_dict)

        type_provider = messages.TypeProvider(
            name=type_provider_ref.typeProvider,
            description=args.description,
            descriptorUrl=args.descriptor_url,
            labels=labels)

        type_providers.AddOptions(args.api_options_file, type_provider)
        request = messages.DeploymentmanagerTypeProvidersInsertRequest(
            project=type_provider_ref.project, typeProvider=type_provider)

        dm_write.Execute(request, args. async,
                         dm_beta_base.GetClient().typeProviders.Insert,
                         LogResource)
コード例 #2
0
ファイル: describe.py プロジェクト: eduardofacanha/Robin
  def Run(self, args):
    """Runs 'type-proivders describe'.

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

    Returns:
      The requested TypeProvider.

    Raises:
      HttpException: An http error response was received while executing the api
          request.
      InvalidArgumentException: The requested type provider could not be found.
    """
    type_provider_ref = dm_beta_base.GetResources().Parse(
        args.provider_name,
        params={'project': properties.VALUES.core.project.GetOrFail},
        collection='deploymentmanager.typeProviders')

    messages = dm_beta_base.GetMessages()
    request = messages.DeploymentmanagerTypeProvidersGetRequest(
        **type_provider_ref.AsDict())
    client = dm_beta_base.GetClient()
    return client.typeProviders.Get(request)
コード例 #3
0
ファイル: list.py プロジェクト: eduardofacanha/Robin
  def Run(self, args):
    """Run 'types list'.

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

    Returns:
      The list of types for this project.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
    type_provider_ref = dm_beta_base.GetResources().Parse(
        args.provider if args.provider else 'NOT_A_PROVIDER',
        params={'project': properties.VALUES.core.project.GetOrFail},
        collection='deploymentmanager.typeProviders')
    self.page_size = args.page_size
    self.limit = args.limit
    self.project = type_provider_ref.project

    if not args.provider:
      type_providers = self._GetTypeProviders()
    else:
      type_providers = [type_provider_ref.typeProvider]

    return dm_v2_util.YieldWithHttpExceptions(
        self._YieldPrintableTypesOrErrors(type_providers))
コード例 #4
0
    def Run(self, args):
        """Runs 'types describe'.

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

    Returns:
      The requested TypeInfo.

    Raises:
      HttpException: An http error response was received while executing the api
          request.
      InvalidArgumentException: The requested type provider type could not
          be found.
    """
        messages = dm_beta_base.GetMessages()
        client = dm_beta_base.GetClient()
        type_provider_ref = dm_beta_base.GetResources().Parse(
            args.provider,
            params={'project': properties.VALUES.core.project.GetOrFail},
            collection='deploymentmanager.typeProviders')
        request = messages.DeploymentmanagerTypeProvidersGetTypeRequest(
            project=type_provider_ref.project,
            type=args.name,
            typeProvider=type_provider_ref.typeProvider)
        type_message = client.typeProviders.GetType(request)

        composite_type_message = 'This is not a composite type.'
        if type_provider_ref.typeProvider == 'composite':
            composite_request = messages.DeploymentmanagerCompositeTypesGetRequest(
                project=type_provider_ref.project, compositeType=args.name)
            composite_type_message = client.compositeTypes.Get(
                composite_request)

        log.status.Print(
            'You can reference this type in Deployment Manager with '
            '[{0}/{1}:{2}]'.format(type_provider_ref.project,
                                   type_provider_ref.typeProvider, args.name))
        return {
            'type_info': type_message,
            'composite_type': composite_type_message
        }
コード例 #5
0
    def Run(self, args):
        """Run 'types list'.

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

    Returns:
      The list of types for this project.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
        type_provider_ref = dm_beta_base.GetResources().Parse(
            args.provider if args.provider else 'NOT_A_PROVIDER',
            params={'project': properties.VALUES.core.project.GetOrFail},
            collection='deploymentmanager.typeProviders')
        self.page_size = args.page_size
        self.limit = args.limit

        if args.provider_project:
            projects = [args.provider_project]
        else:
            # Most users will be interested in the default gcp-types project types,
            # so by default we want to display those
            projects = [type_provider_ref.project, GCP_TYPES_PROJECT]

        type_providers = collections.OrderedDict()
        if not args.provider:
            self._GetTypeProviders(projects, type_providers)
        else:
            for project in projects:
                type_providers[project] = [type_provider_ref.typeProvider]

        return dm_v2_util.YieldWithHttpExceptions(
            self._YieldPrintableTypesOrErrors(type_providers))
コード例 #6
0
def GetReference(name):
    return dm_beta_base.GetResources().Parse(
        name, collection='deploymentmanager.typeProviders')
コード例 #7
0
def GetReference(name):
  return dm_beta_base.GetResources().Parse(
      name,
      params={'project': properties.VALUES.core.project.GetOrFail},
      collection='deploymentmanager.compositeTypes')
コード例 #8
0
ファイル: composite_types.py プロジェクト: mzha/HomewardBound
def GetReference(name):
    return dm_beta_base.GetResources().Parse(
        name, collection='deploymentmanager.compositeTypes')