コード例 #1
0
 def Run(self, args):
   api_version = apis.GetApiVersion(self.ReleaseTrack())
   ref = util.GetPolicyRef()
   if ref.Name() == OLD_SYSTEM_POLICY_PROJECT_NAME:
     raise Error(
         'The Binary Authorization system policy is no longer accessible via '
         'the binauthz-global-policy project. Use the following command to '
         'display the system policy:\n'
         '    $ gcloud alpha container binauthz policy export-system-policy\n'
         'For details, see https://cloud.google.com/binary-authorization/docs/'
         'key-concepts#google-maintained_system_images.')
   return policies.Client(api_version).Get(ref)
コード例 #2
0
  def Run(self, args):
    api_version = apis.GetApiVersion(self.ReleaseTrack())
    messages = apis.GetMessagesModule(api_version)

    # Load the policy file into a Python object.
    policy_obj = parsing.LoadResourceFile(args.policy_file)
    if not policy_obj:
      # NOTE: This is necessary because apitools falls over when you provide it
      # with None and that's what the yaml returns when passed an empty string.
      policy_obj = {}

      # Make sure the user meant to do this.
      log.warning('Empty Policy provided!')
      console_io.PromptContinue(
          prompt_string='Do you want to import an empty policy?',
          cancel_on_no=True)

    # Decode the dict into a Policy message, allowing DecodeErrors to bubble up
    # to the user if they are raised.
    policy = encoding.DictToMessageWithErrorCheck(policy_obj, messages.Policy)

    return policies.Client(api_version).Set(util.GetPolicyRef(), policy)
コード例 #3
0
ファイル: export.py プロジェクト: hiroshiyoshida1980/jpopjam
 def Run(self, args):
   api_version = apis.GetApiVersion(self.ReleaseTrack())
   return policies.Client(api_version).Get(util.GetPolicyRef())
コード例 #4
0
ファイル: export.py プロジェクト: barber223/AudioApp
 def Run(self, args):
     return policies.Client().Get(util.GetPolicyRef())