def to_api_repr(self):
        resource = {}

        if self.etag is not None:
            resource['etag'] = self.etag

        if self.version is not None:
            resource['version'] = self.version

        bindings = []

        if self.owners:
            bindings.append(
                {'role': OWNER_ROLE, 'members': sorted(self.owners)})

        if self.editors:
            bindings.append(
                {'role': EDITOR_ROLE, 'members': sorted(self.editors)})

        if self.viewers:
            bindings.append(
                {'role': VIEWER_ROLE, 'members': sorted(self.viewers)})

        if bindings:
            resource['bindings'] = bindings

        return resource
Construct a Policy resource.
dataset/ETHPy150Open GoogleCloudPlatform/gcloud-python/gcloud/pubsub/iam.py/Policy.to_api_repr