Class JobServiceProtoConverter
- java.lang.Object
-
- com.netflix.genie.common.internal.dtos.converters.JobServiceProtoConverter
-
public class JobServiceProtoConverter extends java.lang.ObjectConverter of proto messages for theJobServiceGrpc.JobServiceImplBaseservice to and from V4 DTO POJO's.- Since:
- 4.0.0
- See Also:
com.netflix.genie.common.internal.dtos,com.netflix.genie.proto
-
-
Constructor Summary
Constructors Constructor Description JobServiceProtoConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgentClientMetadatatoAgentClientMetadataDto(com.netflix.genie.proto.AgentMetadata agentMetadata)Convert a protoAgentMetadatato anAgentClientMetadata.com.netflix.genie.proto.ChangeJobArchiveStatusRequesttoChangeJobStatusArchiveRequestProto(java.lang.String jobId, ArchiveStatus archiveStatus)Creates a request to change the remote job archive status.com.netflix.genie.proto.ChangeJobStatusRequesttoChangeJobStatusRequestProto(@NotBlank java.lang.String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, java.lang.String message)Convert parameters into ChangeJobStatusRequest for the server.com.netflix.genie.proto.ClaimJobRequesttoClaimJobRequestProto(java.lang.String jobId, AgentClientMetadata agentClientMetadata)Convert agent metadata and job id into a ClaimJobRequest for the server.com.netflix.genie.proto.ConfigureRequesttoConfigureRequestProto(AgentClientMetadata agentClientMetadata)Convert parameters into ConfigureRequest for the server.com.netflix.genie.proto.DryRunJobSpecificationRequesttoDryRunJobSpecificationRequestProto(AgentJobRequest jobRequest)Convert a V4 Job Request DTO into a gRPC dry run resolve job specification request to be sent to the server.com.netflix.genie.proto.GetJobStatusRequesttoGetJobStatusRequestProto(java.lang.String jobId)Creates a request to fetch the job status currently seen by the server.com.netflix.genie.proto.HandshakeRequesttoHandshakeRequestProto(AgentClientMetadata agentClientMetadata)Convert parameters into HandshakeRequest for the server.JobRequesttoJobRequestDto(com.netflix.genie.proto.DryRunJobSpecificationRequest request)Convert a gRPC request to dry run a job specification resolution into aJobRequestfor use within Genie server codebase.JobRequesttoJobRequestDto(com.netflix.genie.proto.ReserveJobIdRequest request)Convert a gRPC reserve job id request into a V4 Job Request DTO for use within Genie codebase.JobSpecificationtoJobSpecificationDto(com.netflix.genie.proto.JobSpecification protoSpec)Convert a response from server into a Job Specification DTO which can be used in the codebase free of gRPC.com.netflix.genie.proto.JobSpecificationtoJobSpecificationProto(JobSpecification jobSpecification)Convert a Job Specification DTO to a protobuf message representation.com.netflix.genie.proto.JobSpecificationRequesttoJobSpecificationRequestProto(java.lang.String id)Generate aJobSpecificationRequestfrom the given job id.com.netflix.genie.proto.JobSpecificationResponsetoJobSpecificationResponseProto(JobSpecification jobSpecification)Build aJobSpecificationResponseout of the givenJobSpecification.com.netflix.genie.proto.ReserveJobIdRequesttoReserveJobIdRequestProto(AgentJobRequest jobRequest, AgentClientMetadata agentClientMetadata)Convert a V4 Job Request DTO into a gRPC reserve job id request to be sent to the server.
-
-
-
Method Detail
-
toReserveJobIdRequestProto
public com.netflix.genie.proto.ReserveJobIdRequest toReserveJobIdRequestProto(AgentJobRequest jobRequest, AgentClientMetadata agentClientMetadata) throws GenieConversionException
Convert a V4 Job Request DTO into a gRPC reserve job id request to be sent to the server.- Parameters:
jobRequest- The job request to convertagentClientMetadata- The metadata about the agent- Returns:
- The request that should be sent to the server for a new Job Specification given the parameters
- Throws:
GenieConversionException- if conversion fails
-
toJobSpecificationRequestProto
public com.netflix.genie.proto.JobSpecificationRequest toJobSpecificationRequestProto(java.lang.String id)
Generate aJobSpecificationRequestfrom the given job id.- Parameters:
id- The job id to generate the request for- Returns:
- The request instance
-
toJobRequestDto
public JobRequest toJobRequestDto(com.netflix.genie.proto.ReserveJobIdRequest request) throws GenieConversionException
Convert a gRPC reserve job id request into a V4 Job Request DTO for use within Genie codebase.- Parameters:
request- The request to convert- Returns:
- The job request
- Throws:
GenieConversionException- if conversion fails
-
toDryRunJobSpecificationRequestProto
public com.netflix.genie.proto.DryRunJobSpecificationRequest toDryRunJobSpecificationRequestProto(AgentJobRequest jobRequest) throws GenieConversionException
Convert a V4 Job Request DTO into a gRPC dry run resolve job specification request to be sent to the server.- Parameters:
jobRequest- The job request to convert- Returns:
- The request that should be sent to the server for a new Job Specification given the parameters
- Throws:
GenieConversionException- if conversion fails
-
toJobRequestDto
public JobRequest toJobRequestDto(com.netflix.genie.proto.DryRunJobSpecificationRequest request) throws GenieConversionException
Convert a gRPC request to dry run a job specification resolution into aJobRequestfor use within Genie server codebase.- Parameters:
request- The request to convert- Returns:
- The job request
- Throws:
GenieConversionException- if conversion fails
-
toAgentClientMetadataDto
public AgentClientMetadata toAgentClientMetadataDto(com.netflix.genie.proto.AgentMetadata agentMetadata)
Convert a protoAgentMetadatato anAgentClientMetadata.- Parameters:
agentMetadata- The metadata to convert- Returns:
- The immutable DTO representation
-
toJobSpecificationResponseProto
public com.netflix.genie.proto.JobSpecificationResponse toJobSpecificationResponseProto(JobSpecification jobSpecification)
Build aJobSpecificationResponseout of the givenJobSpecification.- Parameters:
jobSpecification- The job specification to serialize- Returns:
- The response instance
-
toJobSpecificationDto
public JobSpecification toJobSpecificationDto(com.netflix.genie.proto.JobSpecification protoSpec)
Convert a response from server into a Job Specification DTO which can be used in the codebase free of gRPC.- Parameters:
protoSpec- The protobuf specification message- Returns:
- A job specification DTO
-
toJobSpecificationProto
public com.netflix.genie.proto.JobSpecification toJobSpecificationProto(JobSpecification jobSpecification)
Convert a Job Specification DTO to a protobuf message representation.- Parameters:
jobSpecification- TheJobSpecificationto convert- Returns:
- A
JobSpecificationinstance
-
toClaimJobRequestProto
public com.netflix.genie.proto.ClaimJobRequest toClaimJobRequestProto(java.lang.String jobId, AgentClientMetadata agentClientMetadata)Convert agent metadata and job id into a ClaimJobRequest for the server.- Parameters:
jobId- job idagentClientMetadata- agent metadata- Returns:
- a ClaimJobRequest
-
toChangeJobStatusRequestProto
public com.netflix.genie.proto.ChangeJobStatusRequest toChangeJobStatusRequestProto(@NotBlank @NotBlank java.lang.String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, @Nullable java.lang.String message)Convert parameters into ChangeJobStatusRequest for the server.- Parameters:
jobId- job idcurrentJobStatus- the expected current status on the servernewJobStatus- the new current status for this jobmessage- an optional message to record with the state change- Returns:
- a ChangeJobStatusRequest
-
toHandshakeRequestProto
public com.netflix.genie.proto.HandshakeRequest toHandshakeRequestProto(AgentClientMetadata agentClientMetadata) throws GenieConversionException
Convert parameters into HandshakeRequest for the server.- Parameters:
agentClientMetadata- agent client metadata- Returns:
- a
HandshakeRequest - Throws:
GenieConversionException- if the inputs are invalid
-
toConfigureRequestProto
public com.netflix.genie.proto.ConfigureRequest toConfigureRequestProto(AgentClientMetadata agentClientMetadata) throws GenieConversionException
Convert parameters into ConfigureRequest for the server.- Parameters:
agentClientMetadata- agent client metadata- Returns:
- a
ConfigureRequest - Throws:
GenieConversionException- if the inputs are invalid
-
toGetJobStatusRequestProto
public com.netflix.genie.proto.GetJobStatusRequest toGetJobStatusRequestProto(java.lang.String jobId)
Creates a request to fetch the job status currently seen by the server.- Parameters:
jobId- the job id- Returns:
- A
GetJobStatusRequestmessage instance
-
toChangeJobStatusArchiveRequestProto
public com.netflix.genie.proto.ChangeJobArchiveStatusRequest toChangeJobStatusArchiveRequestProto(java.lang.String jobId, ArchiveStatus archiveStatus)Creates a request to change the remote job archive status.- Parameters:
jobId- the job idarchiveStatus- the new archive status- Returns:
- a
ChangeJobArchiveStatusRequestmessage instance
-
-