def apply(self): stub = connection_pb2_grpc.ServicenetworkingConnectionServiceStub( channel.Channel()) request = connection_pb2.ApplyServicenetworkingConnectionRequest() if Primitive.to_proto(self.network): request.resource.network = Primitive.to_proto(self.network) if Primitive.to_proto(self.project): request.resource.project = Primitive.to_proto(self.project) if Primitive.to_proto(self.reserved_peering_ranges): request.resource.reserved_peering_ranges.extend( Primitive.to_proto(self.reserved_peering_ranges)) if Primitive.to_proto(self.service): request.resource.service = Primitive.to_proto(self.service) request.service_account_file = self.service_account_file response = stub.ApplyServicenetworkingConnection(request) self.network = Primitive.from_proto(response.network) self.project = Primitive.from_proto(response.project) self.name = Primitive.from_proto(response.name) self.reserved_peering_ranges = Primitive.from_proto( response.reserved_peering_ranges) self.service = Primitive.from_proto(response.service)
def delete(self, service, service_account_file=""): stub = connection_pb2_grpc.ServicenetworkingConnectionServiceStub( channel.Channel()) request = connection_pb2.DeleteServicenetworkingConnectionRequest() request.service_account_file = service_account_file request.Service = service response = stub.DeleteServicenetworkingConnection(request)
def list(self, project, network, service, service_account_file=""): stub = connection_pb2_grpc.ServicenetworkingConnectionServiceStub( channel.Channel()) request = connection_pb2.ListServicenetworkingConnectionRequest() request.service_account_file = service_account_file request.Project = project request.Network = network request.Service = service return stub.ListServicenetworkingConnection(request).items
def delete(self): stub = connection_pb2_grpc.ServicenetworkingConnectionServiceStub( channel.Channel()) request = connection_pb2.DeleteServicenetworkingConnectionRequest() request.service_account_file = self.service_account_file if Primitive.to_proto(self.network): request.resource.network = Primitive.to_proto(self.network) if Primitive.to_proto(self.project): request.resource.project = Primitive.to_proto(self.project) if Primitive.to_proto(self.reserved_peering_ranges): request.resource.reserved_peering_ranges.extend( Primitive.to_proto(self.reserved_peering_ranges)) if Primitive.to_proto(self.service): request.resource.service = Primitive.to_proto(self.service) response = stub.DeleteServicenetworkingConnection(request)