From da0bd5f7f66b3b8cd851e3befba9b3b10d149d0b Mon Sep 17 00:00:00 2001 From: Joe Ceresini Date: Mon, 18 Mar 2019 15:19:25 -0400 Subject: [PATCH] Add resource for gcp project iam policy --- micromanager/resources/gcp.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/micromanager/resources/gcp.py b/micromanager/resources/gcp.py index c0595c5..0c0aba2 100644 --- a/micromanager/resources/gcp.py +++ b/micromanager/resources/gcp.py @@ -31,6 +31,7 @@ def factory(resource_data, **kargs): resource_type_map = { 'bigquery.datasets': GcpBigqueryDataset, 'compute.instances': GcpComputeInstance, + 'cloudresourcemanager.projects.iam': GcpProjectIam, 'sqladmin.instances': GcpSqlInstance, 'storage.buckets': GcpStorageBucket, 'storage.buckets.iam': GcpStorageBucketIamPolicy @@ -158,3 +159,23 @@ def _update_request_args(self, body): 'project': self.resource_data['project_id'], 'body': body } + + +class GcpProjectIam(GoogleAPIResource): + + service_name = "cloudresourcemanager" + resource_path = "projects" + version = "v1" + get_method = "getIamPolicy" + update_method = "setIamPolicy" + + def _get_request_args(self): + return { + 'resource': self.resource_data['resource_name'] + } + + def _update_request_args(self, body): + return { + 'resource': self.resource_data['resource_name'], + 'body': body + }