Example #1
0
    def Run(self, args):
        client = cloud_bindings_api.Client(version=self._API_VERSION)
        org_ref = cloud_bindings.GetDefaultOrganization()
        if args.IsSpecified('organization'):
            org_ref = types.Resource('accesscontextmanager.organizations')(
                args.organization)

        level_ref = args.CONCEPTS.level.Parse()

        return client.Create(org_ref, args.group_key, level_ref)
Example #2
0
 def testResource(self, value, collection, api_version, expected):
     properties.VALUES.core.project.Set('x')
     properties.VALUES.core.enable_gri.Set(True)
     result = types.Resource(collection, api_version=api_version)(value)
     self.assertEqual(expected, result.RelativeName() if result else None)
Example #3
0
 def testURI(self):
     properties.VALUES.core.enable_gri.Set(True)
     ref = types.Resource(collection='compute.instances')('i:z:p')
     self.assertEqual(ref.SelfLink(), processors.URI(ref))
     self.assertIsNone(processors.URI(None))