Search in sources :

Example 1 with JobName

use of com.google.cloud.video.transcoder.v1.JobName in project java-docs-samples by GoogleCloudPlatform.

the class GetJobState method getJobState.

// Gets the state of a job.
public static void getJobState(String projectId, String location, String jobId) throws IOException {
    // once, and can be reused for multiple requests.
    try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
        JobName jobName = JobName.newBuilder().setProject(projectId).setLocation(location).setJob(jobId).build();
        var getJobRequest = GetJobRequest.newBuilder().setName(jobName.toString()).build();
        // Send the get job request and process the response.
        Job job = transcoderServiceClient.getJob(getJobRequest);
        System.out.println("Job state: " + job.getState());
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) JobName(com.google.cloud.video.transcoder.v1.JobName) Job(com.google.cloud.video.transcoder.v1.Job)

Example 2 with JobName

use of com.google.cloud.video.transcoder.v1.JobName in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchGetJob method getJob.

// Get Job.
public static void getJob(String projectId, String tenantId, String jobId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        JobName name = JobName.ofProjectTenantJobName(projectId, tenantId, jobId);
        GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build();
        Job response = jobServiceClient.getJob(request);
        System.out.format("Job name: %s%n", response.getName());
        System.out.format("Requisition ID: %s%n", response.getRequisitionId());
        System.out.format("Title: %s%n", response.getTitle());
        System.out.format("Description: %s%n", response.getDescription());
        System.out.format("Posting language: %s%n", response.getLanguageCode());
        for (String address : response.getAddressesList()) {
            System.out.format("Address: %s%n", address);
        }
        for (String email : response.getApplicationInfo().getEmailsList()) {
            System.out.format("Email: %s%n", email);
        }
        for (String websiteUri : response.getApplicationInfo().getUrisList()) {
            System.out.format("Website: %s%n", websiteUri);
        }
    }
}
Also used : GetJobRequest(com.google.cloud.talent.v4beta1.GetJobRequest) JobName(com.google.cloud.talent.v4beta1.JobName) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) Job(com.google.cloud.talent.v4beta1.Job)

Example 3 with JobName

use of com.google.cloud.video.transcoder.v1.JobName in project java-docs-samples by GoogleCloudPlatform.

the class DeleteJob method deleteJob.

// Deletes a job.
public static void deleteJob(String projectId, String location, String jobId) throws IOException {
    // once, and can be reused for multiple requests.
    try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
        JobName jobName = JobName.newBuilder().setProject(projectId).setLocation(location).setJob(jobId).build();
        var deleteJobRequest = DeleteJobRequest.newBuilder().setName(jobName.toString()).build();
        // Send the delete job request and process the response.
        transcoderServiceClient.deleteJob(deleteJobRequest);
        System.out.println("Deleted job");
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) JobName(com.google.cloud.video.transcoder.v1.JobName)

Example 4 with JobName

use of com.google.cloud.video.transcoder.v1.JobName in project java-docs-samples by GoogleCloudPlatform.

the class GetJob method getJob.

// Gets a job.
public static void getJob(String projectId, String location, String jobId) throws IOException {
    // once, and can be reused for multiple requests.
    try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
        JobName jobName = JobName.newBuilder().setProject(projectId).setLocation(location).setJob(jobId).build();
        var getJobRequest = GetJobRequest.newBuilder().setName(jobName.toString()).build();
        // Send the get job request and process the response.
        Job job = transcoderServiceClient.getJob(getJobRequest);
        System.out.println("Job: " + job.getName());
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) JobName(com.google.cloud.video.transcoder.v1.JobName) Job(com.google.cloud.video.transcoder.v1.Job)

Example 5 with JobName

use of com.google.cloud.video.transcoder.v1.JobName in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchDeleteJob method deleteJob.

// Delete Job.
public static void deleteJob(String projectId, String tenantId, String jobId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        JobName name = JobName.ofProjectTenantJobName(projectId, tenantId, jobId);
        DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build();
        jobServiceClient.deleteJob(request);
        System.out.println("Deleted job.");
    }
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4beta1.DeleteJobRequest) JobName(com.google.cloud.talent.v4beta1.JobName) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient)

Aggregations

JobName (com.google.cloud.video.transcoder.v1.JobName)3 TranscoderServiceClient (com.google.cloud.video.transcoder.v1.TranscoderServiceClient)3 JobName (com.google.cloud.talent.v4beta1.JobName)2 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)2 Job (com.google.cloud.video.transcoder.v1.Job)2 DeleteJobRequest (com.google.cloud.talent.v4beta1.DeleteJobRequest)1 GetJobRequest (com.google.cloud.talent.v4beta1.GetJobRequest)1 Job (com.google.cloud.talent.v4beta1.Job)1