使用 Google Cloud 人才解决方案 API 未找到名为 projects/**/tenants/** 的租户

使用 Google Cloud 人才解决方案 API 未找到名为 projects/**/tenants/** 的租户

描述:

代码

字符串项目Id =“*****”;

字符串租户Id = “***-ay7tp”;

        try (JobServiceClient jobServiceClient = JobServiceClient.create()) {

        // Construct the list jobs request
        ListJobsRequest.Builder requestBuilder = ListJobsRequest.newBuilder()
                .setParent("projects/" + projectId + "/tenants/" + tenantId).setFilter("status = \"OPEN\"")
                .setJobView(JobView.JOB_VIEW_FULL); // specify which fields to include in the response

        

        // Use the JobServiceClient to list the jobs
        ListJobsPagedResponse response1 = jobServiceClient.listJobs(requestBuilder.build());
        System.out.println(response1.toString());

        TenantName parent = TenantName.of(projectId, tenantId);
        ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent.toString())
                .setFilter("status = \"OPEN\"").build();

        // Print the details of the first 10 jobs in the response
        int count = 0;
        for (com.google.cloud.talent.v4.Job job : jobServiceClient.listJobs(request).iterateAll()) {
            System.out.println("Job title: " + job.getTitle());
            System.out.println("Job description: " + job.getDescription());
            System.out.println("Job posting date: " + job.getPostingPublishTime().toString());
            System.out.println("Job company name: " + job.getCompanyDisplayName());
            System.out.println("Job ID: " + job.getName().substring(job.getName().lastIndexOf("/") + 1));
            System.out.println("----------------------------------------");
            count++;
            if (count >= 10) {
                break;
            }
        }
    }

错误

NOT_FOUND:租户名称为 projects//租户/未找到。跟踪请求 ID:-*****-48e8-961e-************==

相关内容