Пример #1
0
def _Run(args, track, enable_disk=False, enable_accelerator=False):
  """Creates a node template."""
  holder = base_classes.ComputeApiHolder(track)
  client = holder.client

  node_template_ref = flags.MakeNodeTemplateArg().ResolveAsResource(
      args,
      holder.resources,
      scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

  messages = holder.client.messages
  node_template = util.CreateNodeTemplate(
      node_template_ref,
      args,
      project=node_template_ref.project,
      region=node_template_ref.region,
      messages=messages,
      resource_parser=holder.resources,
      enable_disk=enable_disk,
      enable_accelerator=enable_accelerator)
  request = messages.ComputeNodeTemplatesInsertRequest(
      nodeTemplate=node_template,
      project=node_template_ref.project,
      region=node_template_ref.region)

  service = holder.client.apitools_client.nodeTemplates
  return client.MakeRequests([(service, 'Insert', request)])[0]
Пример #2
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client

        node_template_ref = flags.MakeNodeTemplateArg().ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        messages = holder.client.messages
        node_template = util.CreateNodeTemplate(node_template_ref, args,
                                                messages)
        request = messages.ComputeNodeTemplatesInsertRequest(
            nodeTemplate=node_template,
            project=node_template_ref.project,
            region=node_template_ref.region)

        service = holder.client.apitools_client.nodeTemplates
        return client.MakeRequests([(service, 'Insert', request)])[0]