import {z} from 'zod' export type DataSamplingConfig = {behaviors?: (Array<'DATA_SAMPLING_BEHAVIOR_UNSPECIFIED' | 'DISABLED' | 'ALWAYS_ON' | 'EXCEPTIONS'>) | undefined}; export type DebugOptions = {dataSampling?: DataSamplingConfig | undefined, enableHotKeyLogging?: boolean | undefined}; export type AutoscalingSettings = {algorithm?: ('AUTOSCALING_ALGORITHM_UNKNOWN' | 'AUTOSCALING_ALGORITHM_NONE' | 'AUTOSCALING_ALGORITHM_BASIC') | undefined, maxNumWorkers?: number | undefined}; export type Disk = {diskType?: string | undefined, mountPoint?: string | undefined, sizeGb?: number | undefined}; export type Package = {location?: string | undefined, name?: string | undefined, sha256?: string | undefined}; export type SdkHarnessContainerImage = {capabilities?: Array | undefined, containerImage?: string | undefined, environmentId?: string | undefined, useSingleCorePerContainer?: boolean | undefined}; export type WorkerSettings = {baseUrl?: string | undefined, reportingEnabled?: boolean | undefined, servicePath?: string | undefined, shuffleServicePath?: string | undefined, tempStoragePrefix?: string | undefined, workerId?: string | undefined}; export type TaskRunnerSettings = {alsologtostderr?: boolean | undefined, baseTaskDir?: string | undefined, baseUrl?: string | undefined, commandlinesFileName?: string | undefined, continueOnException?: boolean | undefined, dataflowApiVersion?: string | undefined, harnessCommand?: string | undefined, languageHint?: string | undefined, logDir?: string | undefined, logToSerialconsole?: boolean | undefined, logUploadLocation?: string | undefined, oauthScopes?: Array | undefined, parallelWorkerSettings?: WorkerSettings | undefined, streamingWorkerMainClass?: string | undefined, taskGroup?: string | undefined, taskUser?: string | undefined, tempStoragePrefix?: string | undefined, vmId?: string | undefined, workflowFileName?: string | undefined}; export type WorkerPool = {autoscalingSettings?: AutoscalingSettings | undefined, dataDisks?: Array | undefined, defaultPackageSet?: ('DEFAULT_PACKAGE_SET_UNKNOWN' | 'DEFAULT_PACKAGE_SET_NONE' | 'DEFAULT_PACKAGE_SET_JAVA' | 'DEFAULT_PACKAGE_SET_PYTHON') | undefined, diskProvisionedIops?: unknown | undefined, diskProvisionedThroughputMibps?: unknown | undefined, diskSizeGb?: number | undefined, diskSourceImage?: string | undefined, diskType?: string | undefined, ipConfiguration?: ('WORKER_IP_UNSPECIFIED' | 'WORKER_IP_PUBLIC' | 'WORKER_IP_PRIVATE') | undefined, kind?: string | undefined, machineType?: string | undefined, metadata?: {[key: string]: string} | undefined, network?: string | undefined, numThreadsPerWorker?: number | undefined, numWorkers?: number | undefined, onHostMaintenance?: string | undefined, packages?: Array | undefined, poolArgs?: {[key: string]: unknown} | undefined, sdkHarnessContainerImages?: Array | undefined, subnetwork?: string | undefined, taskrunnerSettings?: TaskRunnerSettings | undefined, teardownPolicy?: ('TEARDOWN_POLICY_UNKNOWN' | 'TEARDOWN_ALWAYS' | 'TEARDOWN_ON_SUCCESS' | 'TEARDOWN_NEVER') | undefined, workerHarnessContainerImage?: string | undefined, zone?: string | undefined}; export type Environment = {clusterManagerApiService?: string | undefined, dataset?: string | undefined, debugOptions?: DebugOptions | undefined, experiments?: Array | undefined, flexResourceSchedulingGoal?: ('FLEXRS_UNSPECIFIED' | 'FLEXRS_SPEED_OPTIMIZED' | 'FLEXRS_COST_OPTIMIZED') | undefined, internalExperiments?: {[key: string]: unknown} | undefined, sdkPipelineOptions?: {[key: string]: unknown} | undefined, serviceAccountEmail?: string | undefined, serviceKmsKeyName?: string | undefined, serviceOptions?: Array | undefined, shuffleMode?: ('SHUFFLE_MODE_UNSPECIFIED' | 'VM_BASED' | 'SERVICE_BASED') | undefined, streamingMode?: ('STREAMING_MODE_UNSPECIFIED' | 'STREAMING_MODE_EXACTLY_ONCE' | 'STREAMING_MODE_AT_LEAST_ONCE') | undefined, tempStoragePrefix?: string | undefined, usePublicIps?: boolean | undefined, useStreamingEngineResourceBasedBilling?: boolean | undefined, userAgent?: {[key: string]: unknown} | undefined, version?: {[key: string]: unknown} | undefined, workerPools?: Array | undefined, workerRegion?: string | undefined, workerZone?: string | undefined}; export type JobExecutionStageInfo = {stepName?: Array | undefined}; export type JobExecutionInfo = {stages?: {[key: string]: JobExecutionStageInfo} | undefined}; export type BigTableIODetails = {instanceId?: string | undefined, projectId?: string | undefined, tableId?: string | undefined}; export type BigQueryIODetails = {dataset?: string | undefined, projectId?: string | undefined, query?: string | undefined, table?: string | undefined}; export type DatastoreIODetails = {namespace?: string | undefined, projectId?: string | undefined}; export type FileIODetails = {filePattern?: string | undefined}; export type PubSubIODetails = {subscription?: string | undefined, topic?: string | undefined}; export type SdkBug = {severity?: ('SEVERITY_UNSPECIFIED' | 'NOTICE' | 'WARNING' | 'SEVERE') | undefined, type?: ('TYPE_UNSPECIFIED' | 'GENERAL' | 'PERFORMANCE' | 'DATALOSS') | undefined, uri?: string | undefined}; export type SdkVersion = {bugs?: Array | undefined, sdkSupportStatus?: ('UNKNOWN' | 'SUPPORTED' | 'STALE' | 'DEPRECATED' | 'UNSUPPORTED') | undefined, version?: string | undefined, versionDisplayName?: string | undefined}; export type SpannerIODetails = {databaseId?: string | undefined, instanceId?: string | undefined, projectId?: string | undefined}; export type JobMetadata = {bigTableDetails?: Array | undefined, bigqueryDetails?: Array | undefined, datastoreDetails?: Array | undefined, fileDetails?: Array | undefined, pubsubDetails?: Array | undefined, sdkVersion?: SdkVersion | undefined, spannerDetails?: Array | undefined, userDisplayProperties?: {[key: string]: string} | undefined}; export type DisplayData = {boolValue?: boolean | undefined, durationValue?: unknown | undefined, floatValue?: number | undefined, int64Value?: unknown | undefined, javaClassValue?: string | undefined, key?: string | undefined, label?: string | undefined, namespace?: string | undefined, shortStrValue?: string | undefined, strValue?: string | undefined, timestampValue?: unknown | undefined, url?: string | undefined}; export type ComponentSource = {name?: string | undefined, originalTransformOrCollection?: string | undefined, userName?: string | undefined}; export type ComponentTransform = {name?: string | undefined, originalTransform?: string | undefined, userName?: string | undefined}; export type StageSource = {name?: string | undefined, originalTransformOrCollection?: string | undefined, sizeBytes?: unknown | undefined, userName?: string | undefined}; export type ExecutionStageSummary = {componentSource?: Array | undefined, componentTransform?: Array | undefined, id?: string | undefined, inputSource?: Array | undefined, kind?: ('UNKNOWN_KIND' | 'PAR_DO_KIND' | 'GROUP_BY_KEY_KIND' | 'FLATTEN_KIND' | 'READ_KIND' | 'WRITE_KIND' | 'CONSTANT_KIND' | 'SINGLETON_KIND' | 'SHUFFLE_KIND') | undefined, name?: string | undefined, outputSource?: Array | undefined, prerequisiteStage?: Array | undefined}; export type TransformSummary = {displayData?: Array | undefined, id?: string | undefined, inputCollectionName?: Array | undefined, kind?: ('UNKNOWN_KIND' | 'PAR_DO_KIND' | 'GROUP_BY_KEY_KIND' | 'FLATTEN_KIND' | 'READ_KIND' | 'WRITE_KIND' | 'CONSTANT_KIND' | 'SINGLETON_KIND' | 'SHUFFLE_KIND') | undefined, name?: string | undefined, outputCollectionName?: Array | undefined}; export type PipelineDescription = {displayData?: Array | undefined, executionPipelineStage?: Array | undefined, originalPipelineTransform?: Array | undefined, stepNamesHash?: string | undefined}; export type Parameters = {cpuUtilizationTarget?: number | undefined, latencyTarget?: string | undefined, maxWorkerCount?: number | undefined, minWorkerCount?: number | undefined}; export type AutoscalingSchedule = {crontab?: string | undefined, duration?: unknown | undefined, name?: string | undefined, parameters?: Parameters | undefined, priority?: unknown | undefined, timeZone?: string | undefined, updateTime?: unknown | undefined}; export type RuntimeUpdatableParams = {acceptableBacklogDuration?: unknown | undefined, autoscalingTier?: string | undefined, latencyTier?: string | undefined, maxNumWorkers?: number | undefined, minNumWorkers?: number | undefined, schedules?: Array | undefined, workerUtilizationHint?: number | undefined}; export type ServiceResources = {zones?: Array | undefined}; export type ExecutionStageState = {currentStateTime?: unknown | undefined, executionStageName?: string | undefined, executionStageState?: ('JOB_STATE_UNKNOWN' | 'JOB_STATE_STOPPED' | 'JOB_STATE_RUNNING' | 'JOB_STATE_DONE' | 'JOB_STATE_FAILED' | 'JOB_STATE_CANCELLED' | 'JOB_STATE_UPDATED' | 'JOB_STATE_DRAINING' | 'JOB_STATE_DRAINED' | 'JOB_STATE_PENDING' | 'JOB_STATE_CANCELLING' | 'JOB_STATE_QUEUED' | 'JOB_STATE_RESOURCE_CLEANING_UP' | 'JOB_STATE_PAUSING' | 'JOB_STATE_PAUSED') | undefined}; export type Step = {kind?: string | undefined, name?: string | undefined, properties?: {[key: string]: unknown} | undefined}; export type Job = {clientRequestId?: string | undefined, createTime?: unknown | undefined, createdFromSnapshotId?: string | undefined, currentState?: ('JOB_STATE_UNKNOWN' | 'JOB_STATE_STOPPED' | 'JOB_STATE_RUNNING' | 'JOB_STATE_DONE' | 'JOB_STATE_FAILED' | 'JOB_STATE_CANCELLED' | 'JOB_STATE_UPDATED' | 'JOB_STATE_DRAINING' | 'JOB_STATE_DRAINED' | 'JOB_STATE_PENDING' | 'JOB_STATE_CANCELLING' | 'JOB_STATE_QUEUED' | 'JOB_STATE_RESOURCE_CLEANING_UP' | 'JOB_STATE_PAUSING' | 'JOB_STATE_PAUSED') | undefined, currentStateTime?: unknown | undefined, environment?: Environment | undefined, executionInfo?: JobExecutionInfo | undefined, id?: string | undefined, jobMetadata?: JobMetadata | undefined, labels?: {[key: string]: string} | undefined, location?: string | undefined, name?: string | undefined, pausable?: boolean | undefined, pipelineDescription?: PipelineDescription | undefined, projectId?: string | undefined, replaceJobId?: string | undefined, replacedByJobId?: string | undefined, requestedState?: ('JOB_STATE_UNKNOWN' | 'JOB_STATE_STOPPED' | 'JOB_STATE_RUNNING' | 'JOB_STATE_DONE' | 'JOB_STATE_FAILED' | 'JOB_STATE_CANCELLED' | 'JOB_STATE_UPDATED' | 'JOB_STATE_DRAINING' | 'JOB_STATE_DRAINED' | 'JOB_STATE_PENDING' | 'JOB_STATE_CANCELLING' | 'JOB_STATE_QUEUED' | 'JOB_STATE_RESOURCE_CLEANING_UP' | 'JOB_STATE_PAUSING' | 'JOB_STATE_PAUSED') | undefined, runtimeUpdatableParams?: RuntimeUpdatableParams | undefined, satisfiesPzi?: boolean | undefined, satisfiesPzs?: boolean | undefined, serviceResources?: ServiceResources | undefined, stageStates?: Array | undefined, startTime?: unknown | undefined, steps?: Array | undefined, stepsLocation?: string | undefined, tempFiles?: Array | undefined, transformNameMapping?: {[key: string]: string} | undefined, type?: ('JOB_TYPE_UNKNOWN' | 'JOB_TYPE_BATCH' | 'JOB_TYPE_STREAMING') | undefined}; export type CreateApiV1b3ProjectsProjectIdLocationsLocationJobsArgs = {projectId: string, location: string, replaceJobId?: string | undefined, view?: ('JOB_VIEW_UNKNOWN' | 'JOB_VIEW_SUMMARY' | 'JOB_VIEW_ALL' | 'JOB_VIEW_DESCRIPTION') | undefined, body: Job}; export type CreateApiV1b3ProjectsProjectIdLocationsLocationJobsOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; export const dataSamplingConfig = z.object({behaviors: z.array(z.enum(["DATA_SAMPLING_BEHAVIOR_UNSPECIFIED", "DISABLED", "ALWAYS_ON", "EXCEPTIONS"])).optional()}); export const debugOptions = z.object({dataSampling: dataSamplingConfig.optional(), enableHotKeyLogging: z.boolean().optional()}); export const autoscalingSettings = z.object({algorithm: z.enum(["AUTOSCALING_ALGORITHM_UNKNOWN", "AUTOSCALING_ALGORITHM_NONE", "AUTOSCALING_ALGORITHM_BASIC"]).optional(), maxNumWorkers: z.number().int().optional()}); export const disk = z.object({diskType: z.string().optional(), mountPoint: z.string().optional(), sizeGb: z.number().int().optional()}); export const package = z.object({location: z.string().optional(), name: z.string().optional(), sha256: z.string().optional()}); export const sdkHarnessContainerImage = z.object({capabilities: z.array(z.string()).optional(), containerImage: z.string().optional(), environmentId: z.string().optional(), useSingleCorePerContainer: z.boolean().optional()}); export const workerSettings = z.object({baseUrl: z.string().optional(), reportingEnabled: z.boolean().optional(), servicePath: z.string().optional(), shuffleServicePath: z.string().optional(), tempStoragePrefix: z.string().optional(), workerId: z.string().optional()}); export const taskRunnerSettings = z.object({alsologtostderr: z.boolean().optional(), baseTaskDir: z.string().optional(), baseUrl: z.string().optional(), commandlinesFileName: z.string().optional(), continueOnException: z.boolean().optional(), dataflowApiVersion: z.string().optional(), harnessCommand: z.string().optional(), languageHint: z.string().optional(), logDir: z.string().optional(), logToSerialconsole: z.boolean().optional(), logUploadLocation: z.string().optional(), oauthScopes: z.array(z.string()).optional(), parallelWorkerSettings: workerSettings.optional(), streamingWorkerMainClass: z.string().optional(), taskGroup: z.string().optional(), taskUser: z.string().optional(), tempStoragePrefix: z.string().optional(), vmId: z.string().optional(), workflowFileName: z.string().optional()}); export const workerPool = z.object({autoscalingSettings: autoscalingSettings.optional(), dataDisks: z.array(disk).optional(), defaultPackageSet: z.enum(["DEFAULT_PACKAGE_SET_UNKNOWN", "DEFAULT_PACKAGE_SET_NONE", "DEFAULT_PACKAGE_SET_JAVA", "DEFAULT_PACKAGE_SET_PYTHON"]).optional(), diskProvisionedIops: z.string().optional(), diskProvisionedThroughputMibps: z.string().optional(), diskSizeGb: z.number().int().optional(), diskSourceImage: z.string().optional(), diskType: z.string().optional(), ipConfiguration: z.enum(["WORKER_IP_UNSPECIFIED", "WORKER_IP_PUBLIC", "WORKER_IP_PRIVATE"]).optional(), kind: z.string().optional(), machineType: z.string().optional(), metadata: z.record(z.string(), z.string()).optional(), network: z.string().optional(), numThreadsPerWorker: z.number().int().optional(), numWorkers: z.number().int().optional(), onHostMaintenance: z.string().optional(), packages: z.array(package).optional(), poolArgs: z.record(z.string(), z.unknown()).optional(), sdkHarnessContainerImages: z.array(sdkHarnessContainerImage).optional(), subnetwork: z.string().optional(), taskrunnerSettings: taskRunnerSettings.optional(), teardownPolicy: z.enum(["TEARDOWN_POLICY_UNKNOWN", "TEARDOWN_ALWAYS", "TEARDOWN_ON_SUCCESS", "TEARDOWN_NEVER"]).optional(), workerHarnessContainerImage: z.string().optional(), zone: z.string().optional()}); export const environment = z.object({clusterManagerApiService: z.string().optional(), dataset: z.string().optional(), debugOptions: debugOptions.optional(), experiments: z.array(z.string()).optional(), flexResourceSchedulingGoal: z.enum(["FLEXRS_UNSPECIFIED", "FLEXRS_SPEED_OPTIMIZED", "FLEXRS_COST_OPTIMIZED"]).optional(), internalExperiments: z.record(z.string(), z.unknown()).optional(), sdkPipelineOptions: z.record(z.string(), z.unknown()).optional(), serviceAccountEmail: z.string().optional(), serviceKmsKeyName: z.string().optional(), serviceOptions: z.array(z.string()).optional(), shuffleMode: z.enum(["SHUFFLE_MODE_UNSPECIFIED", "VM_BASED", "SERVICE_BASED"]).optional(), streamingMode: z.enum(["STREAMING_MODE_UNSPECIFIED", "STREAMING_MODE_EXACTLY_ONCE", "STREAMING_MODE_AT_LEAST_ONCE"]).optional(), tempStoragePrefix: z.string().optional(), usePublicIps: z.boolean().optional(), useStreamingEngineResourceBasedBilling: z.boolean().optional(), userAgent: z.record(z.string(), z.unknown()).optional(), version: z.record(z.string(), z.unknown()).optional(), workerPools: z.array(workerPool).optional(), workerRegion: z.string().optional(), workerZone: z.string().optional()}); export const jobExecutionStageInfo = z.object({stepName: z.array(z.string()).optional()}); export const jobExecutionInfo = z.object({stages: z.record(z.string(), jobExecutionStageInfo).optional()}); export const bigTableIODetails = z.object({instanceId: z.string().optional(), projectId: z.string().optional(), tableId: z.string().optional()}); export const bigQueryIODetails = z.object({dataset: z.string().optional(), projectId: z.string().optional(), query: z.string().optional(), table: z.string().optional()}); export const datastoreIODetails = z.object({namespace: z.string().optional(), projectId: z.string().optional()}); export const fileIODetails = z.object({filePattern: z.string().optional()}); export const pubSubIODetails = z.object({subscription: z.string().optional(), topic: z.string().optional()}); export const sdkBug = z.object({severity: z.enum(["SEVERITY_UNSPECIFIED", "NOTICE", "WARNING", "SEVERE"]).optional(), type: z.enum(["TYPE_UNSPECIFIED", "GENERAL", "PERFORMANCE", "DATALOSS"]).optional(), uri: z.string().optional()}); export const sdkVersion = z.object({bugs: z.array(sdkBug).optional(), sdkSupportStatus: z.enum(["UNKNOWN", "SUPPORTED", "STALE", "DEPRECATED", "UNSUPPORTED"]).optional(), version: z.string().optional(), versionDisplayName: z.string().optional()}); export const spannerIODetails = z.object({databaseId: z.string().optional(), instanceId: z.string().optional(), projectId: z.string().optional()}); export const jobMetadata = z.object({bigTableDetails: z.array(bigTableIODetails).optional(), bigqueryDetails: z.array(bigQueryIODetails).optional(), datastoreDetails: z.array(datastoreIODetails).optional(), fileDetails: z.array(fileIODetails).optional(), pubsubDetails: z.array(pubSubIODetails).optional(), sdkVersion: sdkVersion.optional(), spannerDetails: z.array(spannerIODetails).optional(), userDisplayProperties: z.record(z.string(), z.string()).optional()}); export const displayData = z.object({boolValue: z.boolean().optional(), durationValue: z.string().optional(), floatValue: z.number().optional(), int64Value: z.string().optional(), javaClassValue: z.string().optional(), key: z.string().optional(), label: z.string().optional(), namespace: z.string().optional(), shortStrValue: z.string().optional(), strValue: z.string().optional(), timestampValue: z.string().optional(), url: z.string().optional()}); export const componentSource = z.object({name: z.string().optional(), originalTransformOrCollection: z.string().optional(), userName: z.string().optional()}); export const componentTransform = z.object({name: z.string().optional(), originalTransform: z.string().optional(), userName: z.string().optional()}); export const stageSource = z.object({name: z.string().optional(), originalTransformOrCollection: z.string().optional(), sizeBytes: z.string().optional(), userName: z.string().optional()}); export const executionStageSummary = z.object({componentSource: z.array(componentSource).optional(), componentTransform: z.array(componentTransform).optional(), id: z.string().optional(), inputSource: z.array(stageSource).optional(), kind: z.enum(["UNKNOWN_KIND", "PAR_DO_KIND", "GROUP_BY_KEY_KIND", "FLATTEN_KIND", "READ_KIND", "WRITE_KIND", "CONSTANT_KIND", "SINGLETON_KIND", "SHUFFLE_KIND"]).optional(), name: z.string().optional(), outputSource: z.array(stageSource).optional(), prerequisiteStage: z.array(z.string()).optional()}); export const transformSummary = z.object({displayData: z.array(displayData).optional(), id: z.string().optional(), inputCollectionName: z.array(z.string()).optional(), kind: z.enum(["UNKNOWN_KIND", "PAR_DO_KIND", "GROUP_BY_KEY_KIND", "FLATTEN_KIND", "READ_KIND", "WRITE_KIND", "CONSTANT_KIND", "SINGLETON_KIND", "SHUFFLE_KIND"]).optional(), name: z.string().optional(), outputCollectionName: z.array(z.string()).optional()}); export const pipelineDescription = z.object({displayData: z.array(displayData).optional(), executionPipelineStage: z.array(executionStageSummary).optional(), originalPipelineTransform: z.array(transformSummary).optional(), stepNamesHash: z.string().optional()}); export const parameters = z.object({cpuUtilizationTarget: z.number().optional(), latencyTarget: z.string().optional(), maxWorkerCount: z.number().int().optional(), minWorkerCount: z.number().int().optional()}); export const autoscalingSchedule = z.object({crontab: z.string().optional(), duration: z.string().optional(), name: z.string().optional(), parameters: parameters.optional(), priority: z.string().optional(), timeZone: z.string().optional(), updateTime: z.string().optional()}); export const runtimeUpdatableParams = z.object({acceptableBacklogDuration: z.string().optional(), autoscalingTier: z.string().optional(), latencyTier: z.string().optional(), maxNumWorkers: z.number().int().optional(), minNumWorkers: z.number().int().optional(), schedules: z.array(autoscalingSchedule).optional(), workerUtilizationHint: z.number().optional()}); export const serviceResources = z.object({zones: z.array(z.string()).optional()}); export const executionStageState = z.object({currentStateTime: z.string().optional(), executionStageName: z.string().optional(), executionStageState: z.enum(["JOB_STATE_UNKNOWN", "JOB_STATE_STOPPED", "JOB_STATE_RUNNING", "JOB_STATE_DONE", "JOB_STATE_FAILED", "JOB_STATE_CANCELLED", "JOB_STATE_UPDATED", "JOB_STATE_DRAINING", "JOB_STATE_DRAINED", "JOB_STATE_PENDING", "JOB_STATE_CANCELLING", "JOB_STATE_QUEUED", "JOB_STATE_RESOURCE_CLEANING_UP", "JOB_STATE_PAUSING", "JOB_STATE_PAUSED"]).optional()}); export const step = z.object({kind: z.string().optional(), name: z.string().optional(), properties: z.record(z.string(), z.unknown()).optional()}); export const job = z.object({clientRequestId: z.string().optional(), createTime: z.string().optional(), createdFromSnapshotId: z.string().optional(), currentState: z.enum(["JOB_STATE_UNKNOWN", "JOB_STATE_STOPPED", "JOB_STATE_RUNNING", "JOB_STATE_DONE", "JOB_STATE_FAILED", "JOB_STATE_CANCELLED", "JOB_STATE_UPDATED", "JOB_STATE_DRAINING", "JOB_STATE_DRAINED", "JOB_STATE_PENDING", "JOB_STATE_CANCELLING", "JOB_STATE_QUEUED", "JOB_STATE_RESOURCE_CLEANING_UP", "JOB_STATE_PAUSING", "JOB_STATE_PAUSED"]).optional(), currentStateTime: z.string().optional(), environment: environment.optional(), executionInfo: jobExecutionInfo.optional(), id: z.string().optional(), jobMetadata: jobMetadata.optional(), labels: z.record(z.string(), z.string()).optional(), location: z.string().optional(), name: z.string().optional(), pausable: z.boolean().optional(), pipelineDescription: pipelineDescription.optional(), projectId: z.string().optional(), replaceJobId: z.string().optional(), replacedByJobId: z.string().optional(), requestedState: z.enum(["JOB_STATE_UNKNOWN", "JOB_STATE_STOPPED", "JOB_STATE_RUNNING", "JOB_STATE_DONE", "JOB_STATE_FAILED", "JOB_STATE_CANCELLED", "JOB_STATE_UPDATED", "JOB_STATE_DRAINING", "JOB_STATE_DRAINED", "JOB_STATE_PENDING", "JOB_STATE_CANCELLING", "JOB_STATE_QUEUED", "JOB_STATE_RESOURCE_CLEANING_UP", "JOB_STATE_PAUSING", "JOB_STATE_PAUSED"]).optional(), runtimeUpdatableParams: runtimeUpdatableParams.optional(), satisfiesPzi: z.boolean().optional(), satisfiesPzs: z.boolean().optional(), serviceResources: serviceResources.optional(), stageStates: z.array(executionStageState).optional(), startTime: z.string().optional(), steps: z.array(step).optional(), stepsLocation: z.string().optional(), tempFiles: z.array(z.string()).optional(), transformNameMapping: z.record(z.string(), z.string()).optional(), type: z.enum(["JOB_TYPE_UNKNOWN", "JOB_TYPE_BATCH", "JOB_TYPE_STREAMING"]).optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Creates a Dataflow job. To create a job, we recommend using `projects.locations.jobs.create` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.create` is not recommended, as your job will always start in `us-central1`. Do not enter confidential information when you supply string values using the API. # IAM Permissions 1. Requires the `dataflow.jobs.create` permission on the project. 2. `resourcemanager.projects.get` (Specifically required for regional endpoints to resolve regional resource metadata) * * POST /v1b3/projects/{projectId}/locations/{location}/jobs * * Also accepts auth: Oauth2 + Oauth2c */ export const createApiV1b3ProjectsProjectIdLocationsLocationJobs = async (args: CreateApiV1b3ProjectsProjectIdLocationsLocationJobsArgs, options?: CreateApiV1b3ProjectsProjectIdLocationsLocationJobsOptions) => { const {baseUrl = "https://dataflow.googleapis.com", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.replaceJobId != null) query.append("replaceJobId", String(args.replaceJobId)) if (args.view != null) query.append("view", String(args.view)) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1b3/projects/${encodeURIComponent(String(args.projectId))}/locations/${encodeURIComponent(String(args.location))}/jobs${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(job, await res.json()) };