Пример #1
0
    def apply(self):
        stub = identity_aware_proxy_client_pb2_grpc.IapIdentityAwareProxyClientServiceStub(
            channel.Channel()
        )
        request = (
            identity_aware_proxy_client_pb2.ApplyIapIdentityAwareProxyClientRequest()
        )
        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.project):
            request.resource.project = Primitive.to_proto(self.project)

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

        request.service_account_file = self.service_account_file

        response = stub.ApplyIapIdentityAwareProxyClient(request)
        self.name = Primitive.from_proto(response.name)
        self.secret = Primitive.from_proto(response.secret)
        self.display_name = Primitive.from_proto(response.display_name)
        self.project = Primitive.from_proto(response.project)
        self.brand = Primitive.from_proto(response.brand)
Пример #2
0
    def list(self, project, brand, service_account_file=""):
        stub = identity_aware_proxy_client_pb2_grpc.IapIdentityAwareProxyClientServiceStub(
            channel.Channel()
        )
        request = (
            identity_aware_proxy_client_pb2.ListIapIdentityAwareProxyClientRequest()
        )
        request.service_account_file = service_account_file
        request.Project = project

        request.Brand = brand

        return stub.ListIapIdentityAwareProxyClient(request).items