def testParseInvalid(self, args, expected_exception): self.get_client_instance = self.StartObjectPatch( apis, 'GetClientInstance') parser = calliope_util.ArgumentParser() parser.add_argument('--project', help='The project.') util.AddIapIamResourceArgs(parser) with self.assertRaises(expected_exception): parsed_args = parser.parse_args(args) util.ParseIapIamResource(self.track, parsed_args)
def testParse(self, args, expected_type): self.get_client_instance = self.StartObjectPatch( apis, 'GetClientInstance') parser = calliope_util.ArgumentParser() parser.add_argument('--project', help='The project.') util.AddIapIamResourceArgs(parser) parsed_args = parser.parse_args(args) resource = util.ParseIapIamResource(self.track, parsed_args) self.assertEqual(type(resource), expected_type)
def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: The specified function with its description and configured filter. """ iap_iam_ref = iap_util.ParseIapIamResource(self.ReleaseTrack(), args) return iap_iam_ref.GetIamPolicy()
def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: The specified function with its description and configured filter. """ condition = iam_util.ValidateAndExtractConditionMutexRole(args) iap_iam_ref = iap_util.ParseIapIamResource(self.ReleaseTrack(), args) return iap_iam_ref.AddIamPolicyBinding(args.member, args.role, condition)