### Get Job API Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Retrieve details of a specific job using its name. ```APIDOC ## GET /v1beta1/{name} ### Description Retrieves the details of a job. ### Method GET ### Endpoint /v1beta1/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The job name. For example: projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **job** (Job) - The details of the job. #### Response Example ```json { "job": { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "* * * * *", "httpTarget": { "uri": "http://example.com" } } } ``` ``` -------------------------------- ### Job Creation and Configuration Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Defines the structure and configuration options for creating and managing Cloud Scheduler jobs. ```APIDOC ## Job Creation and Configuration ### Description Defines the configuration for a Cloud Scheduler job, including its name, description, schedule, and target execution details. ### Method (Implicitly used within job creation/update operations like `CreateJob`) ### Endpoint (Implicitly used within job creation/update operations) ### Parameters #### Request Body Fields (for Job object) - **name** (string) - Optional (caller-specified in CreateJob, then output only) - The job name in the format `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. PROJECT_ID can contain letters, numbers, hyphens, colons, or periods. LOCATION_ID is the canonical ID for the job's location. JOB_ID can contain letters, numbers, hyphens, or underscores (max 500 characters). - **description** (string) - Optional - A human-readable description for the job (max 500 characters). - **schedule** (string) - Required (except when used with UpdateJob) - Describes the schedule on which the job will be executed. Can be in crontab format or English-like schedule. - **httpTarget** (HttpTarget) - Optional - Configuration for an HTTP target. - **appEngineHttpTarget** (AppEngineHttpTarget) - Optional - Configuration for an App Engine HTTP target. - **retryConfig** (RetryConfig) - Optional - Retry configuration for failed job executions. ### Request Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "description": "My scheduled data processing job", "schedule": "0 * * * *", "httpTarget": { "uri": "https://example.com/process-data", "httpMethod": "POST", "headers": { "Content-Type": "application/json" }, "body": "eyJkYXRhIjogIjEyMy00NTYtNzg5In0=" } } ``` ### Response #### Success Response (200 OK) Returns the created or updated Job object. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "description": "My scheduled data processing job", "schedule": "0 * * * *", "httpTarget": { "uri": "https://example.com/process-data", "httpMethod": "POST", "headers": { "Content-Type": "application/json" }, "body": "eyJkYXRhIjogIjEyMy00NTYtNzg5In0=" }, "state": "ENABLED", "lastExecutionTime": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Initialize Google Cloud CLI Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/authenticate.md Initializes the Google Cloud CLI for authentication. This command is used to set up Application Default Credentials (ADC) in a local environment. ```bash gcloud init ``` -------------------------------- ### Create Compute Engine Instance with Attached Service Account Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/authenticate.md This command creates a Compute Engine virtual machine instance and attaches a specified service account to it. This allows the instance to authenticate to Google Cloud services using the attached service account's credentials. ```bash gcloud compute instances create INSTANCE_NAME --zone=ZONE --service-account=SERVICE_ACCOUNT_EMAIL ``` -------------------------------- ### List Service Accounts using PowerShell Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/authenticate.md Lists service accounts for a specified project using PowerShell. This demonstrates how to authenticate REST requests from the command line by including `gcloud auth print-access-token` to obtain authentication credentials. ```powershell $PROJECT_ID = "your-project-id" $ACCESS_TOKEN = gcloud auth print-access-token Invoke-RestMethod ` -Headers @{ Authorization = "Bearer $ACCESS_TOKEN" } ` -Uri "https://cloudscheduler.googleapis.com/v1/projects/$PROJECT_ID/locations/global/serviceAccounts" ``` -------------------------------- ### AppEngineRouting Configuration Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Specifies the App Engine routing configuration for a Cloud Scheduler job. This allows jobs to be directed to specific services, versions, or instances within an App Engine application. ```protobuf message AppEngineRouting { string service = 1; string version = 2; string instance = 3; } ``` -------------------------------- ### Job Creation API Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md This section details the parameters and request body required for creating a new job in Cloud Scheduler. ```APIDOC ## POST /v1beta1/projects/{parent}/jobs ### Description Creates a new job. ### Method POST ### Endpoint /v1beta1/projects/{parent}/jobs ### Parameters #### Path Parameters - **parent** (string) - Required - The location name. For example: projects/PROJECT_ID/locations/LOCATION_ID. #### Query Parameters None #### Request Body - **job** (Job) - Required - The job to add. The user can optionally specify a name for the job in name. name cannot be the same as an existing job. If a name is not specified then the system will generate a random unique name that will be returned (name) in the response. ### Request Example ```json { "job": { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "* * * * *", "httpTarget": { "uri": "http://example.com" } } } ``` ### Response #### Success Response (200) - **name** (string) - The name of the created job. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job-generated-id" } ``` ``` -------------------------------- ### Create Local ADC File with Service Account Impersonation (Go, Java, Node.js, Python) Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/authenticate.md This command generates a local Application Default Credentials (ADC) file that utilizes service account impersonation. This method is supported for Go, Java, Node.js, and Python client libraries, allowing them to authenticate using a specified service account. ```bash gcloud auth application-default login --impersonate-service-account=SERVICE_ACCT_EMAIL ``` -------------------------------- ### Cloud Scheduler API - Jobs Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/rest.reference.md Endpoints for creating, managing, and deleting jobs in Cloud Scheduler. ```APIDOC ## POST /v1beta1/{parent=projects/*/locations/*}/jobs ### Description Creates a job. ### Method POST ### Endpoint /v1beta1/{parent=projects/*/locations/*}/jobs ### Parameters #### Path Parameters - **parent** (string) - Required - The location name. #### Request Body - **job** (object) - Required - The job to create. - **name** (string) - Optional - The name of the job. If not specified, the system generates a name. - **schedule** (string) - Required - The cron schedule string - **target** (object) - Required - The target for the job. ### Request Example ```json { "job": { "name": "my-job", "schedule": "0 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } } ``` ### Response #### Success Response (200) - **job** (object) - The created job. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "0 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } ``` ## DELETE /v1beta1/{name=projects/*/locations/*/jobs/*} ### Description Deletes a job. ### Method DELETE ### Endpoint /v1beta1/{name=projects/*/locations/*/jobs/*} ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job deleted successfully." } ``` ## GET /v1beta1/{name=projects/*/locations/*/jobs/*} ### Description Gets a job. ### Method GET ### Endpoint /v1beta1/{name=projects/*/locations/*/jobs/*} ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **job** (object) - The job details. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "0 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } ``` ## GET /v1beta1/{parent=projects/*/locations/*}/jobs ### Description Lists jobs. ### Method GET ### Endpoint /v1beta1/{parent=projects/*/locations/*}/jobs ### Parameters #### Path Parameters - **parent** (string) - Required - The location name. ### Response #### Success Response (200) - **jobs** (array) - A list of jobs. #### Response Example ```json { "jobs": [ { "name": "projects/my-project/locations/us-central1/jobs/job1" }, { "name": "projects/my-project/locations/us-central1/jobs/job2" } ] } ``` ## PATCH /v1beta1/{job.name=projects/*/locations/*/jobs/*} ### Description Updates a job. ### Method PATCH ### Endpoint /v1beta1/{job.name=projects/*/locations/*/jobs/*} ### Parameters #### Path Parameters - **job.name** (string) - Required - The name of the job to update. #### Request Body - **job** (object) - Required - The updated job details. ### Request Example ```json { "job": { "schedule": "*/5 * * * *" } } ``` ### Response #### Success Response (200) - **job** (object) - The updated job. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "*/5 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } ``` ## POST /v1beta1/{name=projects/*/locations/*/jobs/*}:pause ### Description Pauses a job. ### Method POST ### Endpoint /v1beta1/{name=projects/*/locations/*/jobs/*}:pause ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job paused successfully." } ``` ## POST /v1beta1/{name=projects/*/locations/*/jobs/*}:resume ### Description Resumes a job. ### Method POST ### Endpoint /v1beta1/{name=projects/*/locations/*/jobs/*}:resume ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job resumed successfully." } ``` ## POST /v1beta1/{name=projects/*/locations/*/jobs/*}:run ### Description Forces a job to run now. ### Method POST ### Endpoint /v1beta1/{name=projects/*/locations/*/jobs/*}:run ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job run initiated successfully." } ``` ## POST /v1/{parent=projects/*/locations/*}/jobs ### Description Creates a job. ### Method POST ### Endpoint /v1/{parent=projects/*/locations/*}/jobs ### Parameters #### Path Parameters - **parent** (string) - Required - The location name. #### Request Body - **job** (object) - Required - The job to create. - **name** (string) - Optional - The name of the job. If not specified, the system generates a name. - **schedule** (string) - Required - The cron schedule string - **target** (object) - Required - The target for the job. ### Request Example ```json { "job": { "name": "my-job", "schedule": "0 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } } ``` ### Response #### Success Response (200) - **job** (object) - The created job. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "0 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } ``` ## DELETE /v1/{name=projects/*/locations/*/jobs/*} ### Description Deletes a job. ### Method DELETE ### Endpoint /v1/{name=projects/*/locations/*/jobs/*} ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job deleted successfully." } ``` ## GET /v1/{name=projects/*/locations/*/jobs/*} ### Description Gets a job. ### Method GET ### Endpoint /v1/{name=projects/*/locations/*/jobs/*} ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **job** (object) - The job details. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "0 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } ``` ## GET /v1/{parent=projects/*/locations/*}/jobs ### Description Lists jobs. ### Method GET ### Endpoint /v1/{parent=projects/*/locations/*}/jobs ### Parameters #### Path Parameters - **parent** (string) - Required - The location name. ### Response #### Success Response (200) - **jobs** (array) - A list of jobs. #### Response Example ```json { "jobs": [ { "name": "projects/my-project/locations/us-central1/jobs/job1" }, { "name": "projects/my-project/locations/us-central1/jobs/job2" } ] } ``` ## PATCH /v1/{job.name=projects/*/locations/*/jobs/*} ### Description Updates a job. ### Method PATCH ### Endpoint /v1/{job.name=projects/*/locations/*/jobs/*} ### Parameters #### Path Parameters - **job.name** (string) - Required - The name of the job to update. #### Request Body - **job** (object) - Required - The updated job details. ### Request Example ```json { "job": { "schedule": "*/5 * * * *" } } ``` ### Response #### Success Response (200) - **job** (object) - The updated job. #### Response Example ```json { "name": "projects/my-project/locations/us-central1/jobs/my-job", "schedule": "*/5 * * * *", "target": { "httpTarget": { "uri": "https://example.com/job" } } } ``` ## POST /v1/{name=projects/*/locations/*/jobs/*}:pause ### Description Pauses a job. ### Method POST ### Endpoint /v1/{name=projects/*/locations/*/jobs/*}:pause ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job paused successfully." } ``` ## POST /v1/{name=projects/*/locations/*/jobs/*}:resume ### Description Resumes a job. ### Method POST ### Endpoint /v1/{name=projects/*/locations/*/jobs/*}:resume ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job resumed successfully." } ``` ## POST /v1/{name=projects/*/locations/*/jobs/*}:run ### Description Forces a job to run now. ### Method POST ### Endpoint /v1/{name=projects/*/locations/*/jobs/*}:run ### Parameters #### Path Parameters - **name** (string) - Required - The job name. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Job run initiated successfully." } ``` ``` -------------------------------- ### List Service Accounts using curl Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/authenticate.md Lists service accounts for a specified project using a curl command. This demonstrates how to authenticate REST requests from the command line by including `gcloud auth print-access-token` to obtain authentication credentials. ```bash PROJECT_ID="your-project-id" ACCESS_TOKEN=$(gcloud auth print-access-token) curl -H "Authorization: Bearer $ACCESS_TOKEN" "https://cloudscheduler.googleapis.com/v1/projects/$PROJECT_ID/locations/global/serviceAccounts" ``` -------------------------------- ### ListJobsResponse Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Response message for listing jobs. ```APIDOC ## ListJobsResponse ### Description Response message for listing jobs using ListJobs. ### Fields - **jobs** (array of Job) - The list of jobs. - **next_page_token** (string) - A token to retrieve next page of results. Pass this value in the page_token field in the subsequent call to ListJobs to retrieve the next page of results. If this is empty it indicates that there are no more results through which to paginate. The page token is valid for only 2 hours. ``` -------------------------------- ### ListJobsRequest Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Request message for listing jobs using ListJobs. ```APIDOC ## ListJobsRequest ### Description Request message for listing jobs using ListJobs. ### Method GET ### Endpoint `/v1beta1/{parent=projects/*/locations/*}/jobs` ### Parameters #### Query Parameters - **page_size** (int32) - Optional - Requested page size. The maximum page size is 500. If unspecified, the page size will be the maximum. Fewer jobs than requested might be returned, even if more jobs exist; use next_page_token to determine if more jobs exist. - **page_token** (string) - Optional - A token identifying a page of results the server will return. To request the first page results, page_token must be empty. To request the next page of results, page_token must be the value of next_page_token returned from the previous call to ListJobs. ### Authorization Requires the following IAM permission on the specified resource parent: `cloudscheduler.jobs.list` ``` -------------------------------- ### CreateJobRequest Structure Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Defines the structure of a CreateJobRequest for the Cloud Scheduler API. It includes the parent location and the job configuration itself. The user can optionally provide a job name; otherwise, the system generates one. ```protobuf message CreateJobRequest { string parent = 1 [(google.api.field_behavior) = REQUIRED]; Job job = 2 [(google.api.field_behavior) = REQUIRED]; } ``` -------------------------------- ### Job Run API Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Endpoint to force a job to run immediately. This is useful for testing or manual triggering of a job. ```APIDOC ## POST /v1beta1/projects/{projectId}/locations/{locationId}/jobs/{jobId}:run ### Description Forces a job to run now. When this method is called, the job will be run immediately as if it had been scheduled. All scheduling will be paused for this job for the duration of the run. ### Method POST ### Endpoint `/v1beta1/projects/{projectId}/locations/{locationId}/jobs/{jobId}:run` ### Parameters #### Path Parameters - **projectId** (string) - Required - The project ID. - **locationId** (string) - Required - The location ID. - **jobId** (string) - Required - The job ID. #### Request Body * **name** (string) - Required - The job name. For example: projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID. Authorization requires the following IAM permission on the specified resource name: cloudscheduler.jobs.run ### Request Example ```json { "name": "projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID" } ``` ### Response #### Success Response (200) - **name** (string) - The name of the job. - **scheduleTime** (string) - Specifies the scheduling time of a job. This is the time when the job was created or last updated. The time is in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. #### Response Example ```json { "name": "projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID", "scheduleTime": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### HTTP Target Configuration Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Configures the HTTP target for a Cloud Scheduler job, specifying the URI, HTTP method, headers, and request body. ```APIDOC ## HTTP Target Configuration ### Description Configures the target for an HTTP request that Cloud Scheduler will make when a job is executed. This includes the URI, HTTP method, headers, and an optional request body. ### Method (Implicitly used within job creation/update) ### Endpoint (Implicitly used within job creation/update) ### Parameters #### Request Body Fields (within Job object) - **httpTarget.uri** (string) - Required - The full URI path that the request will be sent to. Must start with 'http://' or 'https://'. Max length 2083 characters after encoding. - **httpTarget.httpMethod** (HttpMethod) - Optional - The HTTP method to use (POST, GET, HEAD, PUT, DELETE, PATCH, OPTIONS). Defaults to POST if unspecified. - **httpTarget.headers** (map) - Optional - HTTP request headers. The total size of headers must be less than 80KB. Certain headers like Host, Content-Length, User-Agent, X-Google-*, X-AppEngine-*, X-CloudScheduler, X-CloudScheduler-JobName, X-CloudScheduler-ScheduleTime are handled by Cloud Scheduler or have specific values. Content-Type defaults to 'application/octet-stream' if not set and a body is present. - **httpTarget.body** (bytes) - Optional - HTTP request body. Allowed only if httpMethod is POST, PUT, or PATCH. ### Request Example ```json { "httpTarget": { "uri": "https://example.com/api/handler", "httpMethod": "POST", "headers": { "Content-Type": "application/json" }, "body": "ewo8ICJoZWxsbyI6ICJ3b3JsZCIgfQ==" } } ``` ### Response #### Success Response (200 OK) (Details depend on the called service, but Cloud Scheduler expects a 2xx status code for success.) #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Create a Service Account using gcloud CLI Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/authenticate.md This command creates a new service account within your Google Cloud project. Service accounts are used by applications and services to authenticate to Google Cloud. ```bash gcloud iam service-accounts create SERVICE_ACCOUNT_NAME ``` -------------------------------- ### OAuthToken Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Contains information needed for generating an OAuth token for Google APIs. ```APIDOC ## OAuthToken ### Description Contains information needed for generating an OAuth token. This type of authorization should generally only be used when calling Google APIs hosted on *.googleapis.com. ### Fields (No specific fields are detailed in the provided text, but it implies fields necessary for OAuth token generation would be present here.) ``` -------------------------------- ### Cloud Scheduler API Reference Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md This section details the available RPC methods for the Cloud Scheduler API, including their purpose, request types, response types, and authorization scopes. ```APIDOC ## Cloud Scheduler API Overview The Cloud Scheduler API allows external entities to reliably schedule asynchronous jobs. ### Endpoints #### CreateJob ##### Description Creates a job. ##### Method `POST` ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Request Body - **parent** (string) - Required - The project name. Format: `projects/{project_number}`. - **job** (Job) - Required - The job to create. ##### Response ###### Success Response (200) - **Job** (Job) - The created job. #### DeleteJob ##### Description Deletes a job. ##### Method `DELETE` ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs/{jobId}` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Path Parameters - **name** (string) - Required - The job name. Format: `projects/{project_number}/locations/{location_id}/jobs/{job_id}`. ##### Response ###### Success Response (200) - **Empty** (object) - An empty response indicating success. #### GetJob ##### Description Gets a job. ##### Method `GET` ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs/{jobId}` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Path Parameters - **name** (string) - Required - The job name. Format: `projects/{project_number}/locations/{location_id}/jobs/{job_id}`. ##### Response ###### Success Response (200) - **Job** (Job) - The requested job. #### ListJobs ##### Description Lists jobs. ##### Method `GET` ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Query Parameters - **parent** (string) - Required - The project name. Format: `projects/{project_number}`. - **filter** (string) - Optional - Filter expression. - **page_size** (integer) - Optional - The number of jobs to return. - **page_token** (string) - Optional - The page token. ##### Response ###### Success Response (200) - **ListJobsResponse** (ListJobsResponse) - A list of jobs. #### PauseJob ##### Description Pauses a job. The system will stop executing the job until it is re-enabled via ResumeJob. A job must be in `Job.State.ENABLED` to be paused. ##### Method `POST` ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs/{jobId}:pause` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Path Parameters - **name** (string) - Required - The job name. Format: `projects/{project_number}/locations/{location_id}/jobs/{job_id}`. ##### Response ###### Success Response (200) - **Job** (Job) - The paused job. #### ResumeJob ##### Description Resumes a job. This method reenables a job after it has been `Job.State.PAUSED`. A job must be in `Job.State.PAUSED` to be resumed. ##### Method `POST` ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs/{jobId}:resume` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Path Parameters - **name** (string) - Required - The job name. Format: `projects/{project_number}/locations/{location_id}/jobs/{job_id}`. ##### Response ###### Success Response (200) - **Job** (Job) - The resumed job. #### RunJob ##### Description Forces a job to run now. Cloud Scheduler will dispatch the job, even if the job is already running. ##### Method `POST` ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs/{jobId}:run` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Path Parameters - **name** (string) - Required - The job name. Format: `projects/{project_number}/locations/{location_id}/jobs/{job_id}`. ##### Response ###### Success Response (200) - **Job** (Job) - The job that was run. #### UpdateJob ##### Description Updates a job. If successful, the updated Job is returned. If the job does not exist, `NOT_FOUND` is returned. If `UpdateJob` does not successfully return, it is possible for the job to be in an `Job.State.UPDATE_FAILED` state. ##### Method `PUT` or `PATCH` (depending on implementation, typically PATCH for partial updates) ##### Endpoint `/projects/{projectId}/locations/{locationId}/jobs/{jobId}` (example path, actual endpoint may vary based on gRPC/REST) ##### Parameters ###### Path Parameters - **name** (string) - Required - The job name. Format: `projects/{project_number}/locations/{location_id}/jobs/{job_id}`. ###### Request Body - **job** (Job) - Required - The job to update. Only fields specified in the request will be updated. - **update_mask** (FieldMask) - Optional - Field mask used to specify the fields to be overwritten in the job resource. ##### Response ###### Success Response (200) - **Job** (Job) - The updated job. ### Data Types #### HttpMethod (enum) Represents the HTTP method to use for the request. - `HTTP_METHOD_UNSPECIFIED` - `GET` - `PUT` - `POST` - `DELETE` - `HEAD` - `PATCH` - `OPTIONS` - `TRACE` #### AppEngineRouting (message) App Engine routing settings for the job. ##### Fields - **service** (string) - Optional - App Engine service. - **version** (string) - Optional - App Engine version. - **instance** (string) - Optional - App Engine instance. #### AppEngineHttpTarget (message) App Engine target. The job will be pushed to a job handler by means of an HTTP request via an `http_method` such as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an HTTP response code in the range [200 - 299]. Error 503 is considered an App Engine system error instead of an application error. Requests returning error 503 will be retried regardless of retry configuration and not counted against retry counts. Any other response code, or a failure to receive a response before the deadline, constitutes a failed attempt. ##### Fields - **http_method** (HttpMethod) - The HTTP method to use for the request. PATCH and OPTIONS are not permitted. - **app_engine_routing** (AppEngineRouting) - App Engine Routing setting for the job. - **relative_uri** (string) - The relative URI. The relative URL must begin with "/" and must be a valid HTTP relative URL. It can contain a path, query string arguments, and # fragments. If the relative URL is empty, then the root path "/" will be used. No spaces are allowed, and the maximum length allowed is 2083 characters. - **headers** (map) - HTTP request headers. #### HttpTarget (message) HTTP target. The job will be pushed to a job handler by means of an HTTP request via an http_method such as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an HTTP response code in the range [200 - 299]. Error 503 is considered an App Engine system error instead of an application error. Requests returning error 503 will be retried regardless of retry configuration and not counted against retry counts. Any other response code, or a failure to receive a response before the deadline, constitutes a failed attempt. ##### Fields - **http_method** (HttpMethod) - The HTTP method to use for the request. PATCH and OPTIONS are not permitted. - **uri** (string) - The URI to which the HTTP request is dispatched. - **headers** (map) - HTTP request headers. - **body** (string) - HTTP request body. This must be a valid UTF-8 string and may not exceed 8MB. - **oidc_token** (OidcToken) - If specified, an OIDC token will be included as an Authorization header in the HTTP request. The token will be automatically generated by Cloud Scheduler using the IAM service account specified in the OIDC token configuration. This requires that the service account has the appropriate permissions to authenticate to the target. - **oauth_token** (OAuthToken) - If specified, an OAuth token will be included as an Authorization header in the HTTP request. This requires that the service account has the appropriate permissions to authenticate to the target. #### Job (message) Job represents a job configuration. ##### Fields - **name** (string) - The name of the job. Format: `projects/{project_number}/locations/{location_id}/jobs/{job_id}`. - **description** (string) - Description of the job, which may affect the job's behavior if specified. - **schedule** (string) - Describes the schedule on which the job will be run, while `time_zone` specifies in which it is to be interpreted. - **time_zone** (string) - Specifies the timezone in which the schedule is interpreted. - **app_engine_http_target** (AppEngineHttpTarget) - If present, a valid App Engine HTTP target must be specified. Mutually exclusive with `http_target` and `pubsub_target`. - **http_target** (HttpTarget) - If present, a valid HTTP target must be specified. Mutually exclusive with `app_engine_http_target` and `pubsub_target`. - **pubsub_target** (PubsubTarget) - If present, a valid Pub/Sub target must be specified. Mutually exclusive with `http_target` and `app_engine_http_target`. - **retry_config** (RetryConfig) - Contains information about retry configuration. - **state** (Job.State) - Output only. The state of a Job. - **status** (JobStatus) - Output only. The `status` field shows the results of the last attempted execution of this job. - **last_run_time** (Timestamp) - Output only. The time that the job was last successfully executed. - **next_run_time** (Timestamp) - Output only. The time that the job will be next executed. #### Job.State (enum) Represents the state of a job. - `STATE_UNSPECIFIED` - `ENABLED` - `PAUSED` - `UPDATE_FAILED` #### ListJobsResponse (message) Response message for the `ListJobs` method. ##### Fields - **jobs** (array) - The list of jobs that were returned. - **next_page_token** (string) - A token to retrieve the next page of results. If there are no more pages, this field will be empty. #### OAuthToken (message) Contains information about an OAuth token. ##### Fields - **service_account_email** (string) - If specified, then the OAuth token will be generated for the service account specified. If not specified, the default App Engine service account will be used. - **scope** (string) - The OAuth scope to be used when generating the OAuth token. #### OidcToken (message) Contains information about an OIDC token. ##### Fields - **service_account_email** (string) - If specified, then the OIDC token will be generated for the service account specified. If not specified, the default App Engine service account will be used. - **audience** (string) - Audience to be used when creating the OIDC token. #### PubsubTarget (message) Pub/Sub target. The job will be pushed to a Pub/Sub topic by means of a publish message. ##### Fields - **topic_name** (string) - The full path to the Pub/Sub topic that will be used to publish messages. Examples: `projects/cloud-scheduler/topics/pubsub-topic`, `us-central1/topics/my-topic`. - **attributes** (map) - HTTP request headers. - **write_metadata** (boolean) - If true, Pub/Sub message metadata will be included in the Pub/Sub message. #### RetryConfig (message) Retry config for a job. ##### Fields - **max_retry_count** (integer) - The maximum number of times a job attempt should be retried. If the value is 0, then attempts will not be retried. - **max_retry_duration** (Duration) - The maximum amount of time to spend retrying the job. If this value is set to zero, then retries are not limited by time. - **min_backoff_duration** (Duration) - The minimum amount of time to wait between attempts. If this value is set to zero, then the default value of 5 seconds will be used. - **max_backoff_duration** (Duration) - The maximum amount of time to wait between attempts. If this value is set to zero, then the default value of 10 minutes will be used. - **max_doublings** (integer) - The maximum number of doublings to apply to the backoff period. If this value is set to zero, then the default value of 5 will be used. ### Authorization All Cloud Scheduler API methods require authentication and authorization. The following OAuth scopes are required for all methods: - `https://www.googleapis.com/auth/cloud-platform` - `https://www.googleapis.com/auth/cloud-scheduler` For more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/overview). ``` -------------------------------- ### Cloud Scheduler API - Locations Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/rest.reference.md Endpoints for managing locations within the Cloud Scheduler API. ```APIDOC ## GET /v1beta1/{name=projects/*/locations/*} ### Description Gets information about a location. ### Method GET ### Endpoint /v1beta1/{name=projects/*/locations/*} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the location. ### Response #### Success Response (200) - **location** (object) - Information about the location. - **name** (string) - The name of the location. #### Response Example { "name": "projects/my-project/locations/us-central1" } ## GET /v1beta1/{name=projects/*}/locations ### Description Lists information about the supported locations for this service. ### Method GET ### Endpoint /v1beta1/{name=projects/*}/locations ### Parameters #### Path Parameters - **name** (string) - Required - The project name. ### Response #### Success Response (200) - **locations** (array) - A list of supported locations. #### Response Example { "locations": [ { "name": "us-central1" }, { "name": "europe-west1" } ] } ## GET /v1/{name=projects/*/locations/*} ### Description Gets information about a location. ### Method GET ### Endpoint /v1/{name=projects/*/locations/*} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the location. ### Response #### Success Response (200) - **location** (object) - Information about the location. - **name** (string) - The name of the location. #### Response Example { "name": "projects/my-project/locations/us-central1" } ## GET /v1/{name=projects/*}/locations ### Description Lists information about the supported locations for this service. ### Method GET ### Endpoint /v1/{name=projects/*}/locations ### Parameters #### Path Parameters - **name** (string) - Required - The project name. ### Response #### Success Response (200) - **locations** (array) - A list of supported locations. #### Response Example { "locations": [ { "name": "us-central1" }, { "name": "europe-west1" } ] } ``` -------------------------------- ### Log in to Google Cloud CLI for ADC Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/authenticate.md Creates local authentication credentials for your user account, used by Application Default Credentials (ADC). This is necessary for client libraries or third-party tools to authenticate in a local development environment. Do not run this command if you are using Cloud Shell. ```bash gcloud auth application-default login ``` -------------------------------- ### Cloud Scheduler Default Headers Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md Information about default headers set by Cloud Scheduler and headers that can be overridden or are output only. ```APIDOC ## Cloud Scheduler Request Headers ### Default Headers Cloud Scheduler sets the following headers by default: - **User-Agent**: By default, this header is "AppEngine-Google; (+http://code.google.com/appengine)". This header can be modified, but Cloud Scheduler will append "AppEngine-Google; (+http://code.google.com/appengine)" to the modified User-Agent. - **X-CloudScheduler**: This header will be set to true. - **X-CloudScheduler-JobName**: This header will contain the job name. - **X-CloudScheduler-ScheduleTime**: For Cloud Scheduler jobs specified in the unix-cron format, this header will contain the job schedule as an offset of UTC parsed according to RFC3339. ### Overridable Headers (when job has a body) If the job has a body and the following headers are not set by the user, Cloud Scheduler sets default values: - **Content-Type**: This will be set to "application/octet-stream". You can override this default by explicitly setting Content-Type to a particular media type when creating the job. For example, you can set Content-Type to "application/json". ### Output Only Headers The following headers are output only and cannot be set or overridden: - **Content-Length**: This is computed by Cloud Scheduler. - **X-Google-***: For Google internal use only. - **X-AppEngine-***: For Google internal use only. ### App Engine Specific Headers Some App Engine headers, which contain job-specific information, are also sent to the job handler. #### AppEngineRouting - **service** (string) - App service. By default, the job is sent to the service which is the default service when the job is attempted. - **version** (string) - App version. By default, the job is sent to the version which is the default version when the job is attempted. - **instance** (string) - App instance. By default, the job is sent to an instance which is available when the job is attempted. - **host** (string) - Output only. The host that the job is sent to. ``` -------------------------------- ### Cloud Scheduler Default Headers Source: https://github.com/sid-newby/gcpscheduler-documentation/blob/main/api.md This section describes the default headers that Cloud Scheduler sets for jobs, including User-Agent, X-CloudScheduler, X-CloudScheduler-JobName, X-CloudScheduler-ScheduleTime, and Content-Type. It also mentions output-only headers like Content-Length and X-Google-*. ```text User-Agent: AppEngine-Google; (+http://code.google.com/appengine) X-CloudScheduler: true X-CloudScheduler-JobName: [job name] X-CloudScheduler-ScheduleTime: [RFC3339 offset of UTC] Content-Type: application/octet-stream (default, can be overridden) ```