コード例 #1
0
    def Run(self, args):
        """Describe a job template."""
        client = templates.TemplatesClient(self.ReleaseTrack())

        template_ref = args.CONCEPTS.template_id.Parse()

        return client.Get(template_ref)
コード例 #2
0
    def Run(self, args):
        """List job templates."""
        client = templates.TemplatesClient(self.ReleaseTrack())

        parent_ref = args.CONCEPTS.location.Parse()

        return client.List(parent_ref, page_size=args.page_size)
コード例 #3
0
ファイル: create.py プロジェクト: PrateekKhatri/gcloud_cli
    def Run(self, args):
        """Create a job template."""
        client = templates.TemplatesClient()

        template_ref = args.CONCEPTS.template_id.Parse()

        parent_ref = template_ref.Parent()
        template_id = template_ref.jobTemplatesId
        content = util.GetContent(args.file, args.json)

        return client.Create(parent_ref=parent_ref,
                             template_id=template_id,
                             template_json=content)
コード例 #4
0
    def Run(self, args):
        """Deletes a job template."""
        client = templates.TemplatesClient(self.ReleaseTrack())

        template_ref = args.CONCEPTS.template_id.Parse()

        console_io.PromptContinue(
            'You are about to delete template [{}]'.format(
                template_ref.jobTemplatesId),
            throw_if_unattended=True,
            cancel_on_no=True)

        result = client.Delete(template_ref)
        log.DeletedResource(template_ref.RelativeName(), kind='template')
        return result