Пример #1
0
    def Args(parser):
        help_text = {
            "api": ("The API proxy whose deployments should be listed. If not "
                    "provided, all proxies will be listed. To get a list of "
                    "existing API proxies, run "
                    "`{{grandparent_command}} apis list`."),
            "environment":
            ("The environment whose deployments should be listed. "
             "If not provided, all environments will be listed. "
             "To get a list of available environments, run "
             "`{{grandparent_command}} environments list`."),
            "organization":
            ("The organization whose deployments should be listed."
             "If unspecified, the Cloud Platform project's "
             "associated organization will be used."),
        }

        # When Calliope parses a resource's resource arguments, it interprets them
        # as an all-or-nothing whole; if any of them are not provided the whole
        # resource defaults to None.
        #
        # Thus, to make individual parts of the search path optional for the user
        # while accepting others, fallthrough logic for those arguments must be
        # present to return a placeholder value that can be recognized after parsing
        # and interpreted as "no value provided".
        #
        # Unfortunately, `None` won't work as the placeholder, because a fallthrough
        # class returning "None" means it was unable to provide a value at all.
        # Thus, some other value must be chosen.
        fallthroughs = [
            defaults.GCPProductOrganizationFallthrough(),
            # For `revision`, the placeholder MUST be a string, because gcloud
            # concepts will try to parse it as a URL or fully qualified path, and
            # will choke on non-string values. This should be safe as all legitimate
            # revisions are numeric.
            defaults.StaticFallthrough("revision", "all"),
            # For other arguments, the placeholder must not be a string; any string
            # provided here might collide with a real environment or API name. Use
            # the Python builtin function all() as a convenient, idiomatic
            # alternative.
            defaults.StaticFallthrough("environment", all),
            defaults.StaticFallthrough("api", all),
        ]
        resource_args.AddSingleResourceArgument(
            parser,
            "organization.environment.api.revision",
            "API proxy revision and environment whose deployments should be "
            "listed. Providing a REVISION is only valid if API is also specified. "
            "If no REVISION is provided, all deployed revisions that match the "
            "other arguments will be included.",
            positional=False,
            required=True,
            fallthroughs=fallthroughs,
            help_texts=help_text)
        parser.display_info.AddFormat("table(environment,apiProxy,revision)")
Пример #2
0
  def Args(parser):
    help_text = {
        "api": "Deployed API proxy.",
        "environment": "Environment in which the proxy was deployed.",
        "organization": ("Apigee Organization of the proxy and environment. If "
                         "unspecified, the Cloud Platform project's associated "
                         "organization will be used."),
    }
    fallthroughs = [
        defaults.GCPProductOrganizationFallthrough(),
        defaults.StaticFallthrough("revision", "auto")
    ]
    resource_args.AddSingleResourceArgument(
        parser,
        "organization.environment.api.revision",
        """\
API proxy revision and environment of the deployment to be described.


To get a list of deployed proxies and their environments, run:

    $ {parent_command} list

REVISION can either be a positive revision number, or the special value
``auto'', which will choose whichever revision of API is currently deployed in
ENVIRONMENT, or return an error if more than one revision is deployed.


If REVISION is unspecified, the default is ``auto''.

""",
        fallthroughs=fallthroughs,
        help_texts=help_text)
Пример #3
0
    def Args(parser):
        parser.add_argument(
            "--override",
            action="store_true",
            help=
            ("Whether to force the deployment of the new revision over the " +
             "currently deployed revision by overriding conflict checks.\n\n" +
             "If an existing API proxy revision is deployed, set this flag " +
             "to ensure seamless deployment with zero downtime. In this " +
             "case, the existing revision remains deployed until the new " +
             "revision is fully deployed. If not set, you must undeploy " +
             "the currently deployed revision before deploying the new " +
             "revision."))

        help_text = {
            "api": "The API proxy to be deployed.",
            "environment": "The environment in which to deploy the API proxy.",
            "organization":
            "The Apigee organization of the proxy and environment."
        }
        fallthroughs = [
            defaults.GCPProductOrganizationFallthrough(),
            defaults.StaticFallthrough("revision", "latest")
        ]
        resource_args.AddSingleResourceArgument(
            parser,
            "organization.environment.api.revision",
            "The API proxy revision to be deployed, and the environment in which "
            "to deploy it. The revision defaults to `latest`, a special value "
            "which will use the latest revision of the API proxy.",
            fallthroughs=fallthroughs,
            help_texts=help_text)
Пример #4
0
    def Args(parser):
        help_text = {
            "api":
            "API proxy to be undeployed. Must currently be deployed. To "
            "get a list of available deployed proxies, run "
            "`{{grandparent_command}} deployments list --environment=ENV`.",
            "environment":
            "Environment from which to undeploy the API proxy. To "
            "get a list of available environments, run "
            "`{{grandparent_command}} environments list`.",
            "organization":
            "Apigee organization of the proxy and environment."
        }

        fallthroughs = [
            defaults.GCPProductOrganizationFallthrough(),
            defaults.StaticFallthrough("revision", "auto")
        ]
        resource_args.AddSingleResourceArgument(
            parser,
            "organization.environment.api.revision",
            "API proxy revision to be undeployed and environment from which it "
            "should be removed.\n\n"
            "Revisions can either be a positive revision number, or the special "
            "value ``auto'', which will undeploy whatever revision is currently "
            "deployed. If revision is unspecified, the default is ``auto''.",
            fallthroughs=fallthroughs,
            help_texts=help_text)
Пример #5
0
    def Args(parser):
        help_text = {
            "api": "The API proxy whose deployments should be listed.",
            "environment":
            "The environment whose deployments should be listed. "
            "If not provided, all environments will be listed.",
            "organization":
            "The organization whose deployments should be listed."
        }

        # `api` is a required argument for this command, but `environment` and
        # `revision` are not. In order to make `api` required, the whole resource
        # argument has to be "required" from gcloud concepts's point of view.
        #
        # Thus, to make `environment` and `revision` optional for the user, they
        # must be given fallthrough logic that fills in a placeholder value; this
        # value can then be recognized after parsing and interpreted as "no value
        # provided".
        #
        # Unfortunately, `None` won't work as the placeholder, because a fallthrough
        # class returning "None" means it was unable to provide a value at all.
        # Thus, some other value must be chosen.
        fallthroughs = [
            defaults.GCPProductOrganizationFallthrough(),
            # For `environment`, the placeholder must not be a string; any string
            # provided here might collide with a real environment name. Use the
            # Python builtin function all() as a convenient, idiomatic alternative.
            defaults.StaticFallthrough("environment", all),
            # For `revision`, the placeholder MUST be a string, because gcloud
            # concepts will try to parse it as a URL or fully qualified path, and
            # will choke on non-string values. This should be safe as all legitimate
            # revisions are numeric.
            defaults.StaticFallthrough("revision", "all")
        ]
        resource_args.AddSingleResourceArgument(
            parser,
            "organization.environment.api.revision",
            "The API proxy revision whose deployments should be listed. If a "
            "`--revision` is not provided, all revisions will be listed.",
            positional=False,
            required=True,
            fallthroughs=fallthroughs,
            help_texts=help_text)
        parser.display_info.AddFormat("list")
Пример #6
0
 def Args(parser):
   help_text = {
       "api": "The API proxy to be undeployed.",
       "environment": "The environment from which to undeploy the API proxy.",
       "organization": "The organization of the proxy and environment."
   }
   fallthroughs = [defaults.GCPProductOrganizationFallthrough(),
                   defaults.StaticFallthrough("revision", "auto")]
   resource_args.AddSingleResourceArgument(
       parser, "organization.environment.api.revision",
       "The API proxy revision to be undeployed, and the environment from "
       "which it should be removed. The revision defaults to `auto`, which "
       "will undeploy whichever revision is currently deployed, unless there "
       "is more than one such revision.",
       fallthroughs=fallthroughs, help_texts=help_text)
Пример #7
0
 def Args(parser):
     fallthroughs = [
         defaults.GCPProductOrganizationFallthrough(),
         defaults.StaticFallthrough("developer", ANY_DEVELOPER)
     ]
     resource_args.AddSingleResourceArgument(
         parser,
         "organization.developer",
         "Apigee organization, and optionally developer, whose applications "
         "should be listed. If developer is not specified, all developers will "
         "be listed.\n\n"
         "To get a list of valid developers, run:\n\n"
         "    $ {grandparent_command} developers list\n\n",
         positional=False,
         fallthroughs=fallthroughs)
     parser.display_info.AddFormat("table(appId, name)")
Пример #8
0
 def Args(parser):
     help_text = {
         "api": "The deployed API proxy.",
         "environment": "The environment in which the proxy was deployed.",
         "organization": "The organization of the proxy and environment."
     }
     fallthroughs = [
         defaults.GCPProductOrganizationFallthrough(),
         defaults.StaticFallthrough("revision", "auto")
     ]
     resource_args.AddSingleResourceArgument(
         parser,
         "organization.environment.api.revision",
         "The API proxy revision and environment of the deployment to be "
         "described. `REVISION` defaults to ``auto'', which will describe "
         "whichever revision is currently deployed. However, if more than one "
         "revision of `API` is deployed in `ENVIRONMENT`, then an explicit "
         "`REVISION` is required or the command will fail.",
         fallthroughs=fallthroughs,
         help_texts=help_text)