コード例 #1
0
    def delete(self):
        stub = network_endpoint_group_pb2_grpc.ComputeBetaNetworkEndpointGroupServiceStub(
            channel.Channel())
        request = (network_endpoint_group_pb2.
                   DeleteComputeBetaNetworkEndpointGroupRequest())
        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.description):
            request.resource.description = Primitive.to_proto(self.description)

        if NetworkEndpointGroupNetworkEndpointTypeEnum.to_proto(
                self.network_endpoint_type):
            request.resource.network_endpoint_type = NetworkEndpointGroupNetworkEndpointTypeEnum.to_proto(
                self.network_endpoint_type)

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

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

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

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

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

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

        if NetworkEndpointGroupCloudRun.to_proto(self.cloud_run):
            request.resource.cloud_run.CopyFrom(
                NetworkEndpointGroupCloudRun.to_proto(self.cloud_run))
        else:
            request.resource.ClearField("cloud_run")
        if NetworkEndpointGroupAppEngine.to_proto(self.app_engine):
            request.resource.app_engine.CopyFrom(
                NetworkEndpointGroupAppEngine.to_proto(self.app_engine))
        else:
            request.resource.ClearField("app_engine")
        if NetworkEndpointGroupCloudFunction.to_proto(self.cloud_function):
            request.resource.cloud_function.CopyFrom(
                NetworkEndpointGroupCloudFunction.to_proto(
                    self.cloud_function))
        else:
            request.resource.ClearField("cloud_function")
        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        response = stub.DeleteComputeBetaNetworkEndpointGroup(request)
コード例 #2
0
    def list(self, project, location, service_account_file=""):
        stub = network_endpoint_group_pb2_grpc.ComputeBetaNetworkEndpointGroupServiceStub(
            channel.Channel())
        request = (network_endpoint_group_pb2.
                   ListComputeBetaNetworkEndpointGroupRequest())
        request.service_account_file = service_account_file
        request.Project = project

        request.Location = location

        return stub.ListComputeBetaNetworkEndpointGroup(request).items