def list(self, project, service_account_file=""):
        stub = service_account_pb2_grpc.IamServiceAccountServiceStub(channel.Channel())
        request = service_account_pb2.ListIamServiceAccountRequest()
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListIamServiceAccount(request).items
    def apply(self):
        stub = service_account_pb2_grpc.IamServiceAccountServiceStub(channel.Channel())
        request = service_account_pb2.ApplyIamServiceAccountRequest()
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.display_name):
            request.resource.display_name = Primitive.to_proto(self.display_name)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if ServiceAccountActasResources.to_proto(self.actas_resources):
            request.resource.actas_resources.CopyFrom(
                ServiceAccountActasResources.to_proto(self.actas_resources)
            )
        else:
            request.resource.ClearField("actas_resources")
        request.service_account_file = self.service_account_file

        response = stub.ApplyIamServiceAccount(request)
        self.name = Primitive.from_proto(response.name)
        self.project = Primitive.from_proto(response.project)
        self.unique_id = Primitive.from_proto(response.unique_id)
        self.email = Primitive.from_proto(response.email)
        self.display_name = Primitive.from_proto(response.display_name)
        self.description = Primitive.from_proto(response.description)
        self.oauth2_client_id = Primitive.from_proto(response.oauth2_client_id)
        self.actas_resources = ServiceAccountActasResources.from_proto(
            response.actas_resources
        )
        self.disabled = Primitive.from_proto(response.disabled)
예제 #3
0
    def delete(self, project, name, service_account_file=""):
        stub = service_account_pb2_grpc.IamServiceAccountServiceStub(channel.Channel())
        request = service_account_pb2.DeleteIamServiceAccountRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteIamServiceAccount(request)
    def delete(self):
        stub = service_account_pb2_grpc.IamServiceAccountServiceStub(channel.Channel())
        request = service_account_pb2.DeleteIamServiceAccountRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.display_name):
            request.resource.display_name = Primitive.to_proto(self.display_name)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if ServiceAccountActasResources.to_proto(self.actas_resources):
            request.resource.actas_resources.CopyFrom(
                ServiceAccountActasResources.to_proto(self.actas_resources)
            )
        else:
            request.resource.ClearField("actas_resources")
        response = stub.DeleteIamServiceAccount(request)