{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-cloud-dataproc/json-schema/google-cloud-dataproc-session-schema.json",
  "title": "Session",
  "description": "A representation of a session.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-cloud-dataproc-dataproc-projects-api-openapi.yml#/components/schemas/Session",
  "properties": {
    "labels": {
      "description": "Optional. The labels to associate with the session. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a session.",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "sparkConnectSession": {
      "$ref": "#/$defs/SparkConnectConfig",
      "description": "Optional. Spark connect session config."
    },
    "createTime": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. The time when the session was created.",
      "format": "google-datetime"
    },
    "runtimeInfo": {
      "$ref": "#/$defs/RuntimeInfo",
      "description": "Output only. Runtime information about session execution."
    },
    "uuid": {
      "description": "Output only. A session UUID (Unique Universal Identifier). The service generates this value when it creates the session.",
      "type": "string",
      "readOnly": true
    },
    "state": {
      "description": "Output only. A state of the session.",
      "type": "string",
      "enum": [
        "STATE_UNSPECIFIED",
        "CREATING",
        "ACTIVE",
        "TERMINATING",
        "TERMINATED",
        "FAILED"
      ],
      "readOnly": true
    },
    "name": {
      "type": "string",
      "description": "Identifier. The resource name of the session."
    },
    "runtimeConfig": {
      "$ref": "#/$defs/RuntimeConfig",
      "description": "Optional. Runtime configuration for the session execution."
    },
    "user": {
      "type": "string",
      "description": "Optional. The email address of the user who owns the session."
    },
    "stateMessage": {
      "description": "Output only. Session state details, such as the failure description if the state is FAILED.",
      "readOnly": true,
      "type": "string"
    },
    "sessionTemplate": {
      "description": "Optional. The session template used by the session.Resource names and short template IDs are valid. Examples: * projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id] * [template_id]The template must be in the same project and Dataproc region as the session.",
      "type": "string"
    },
    "creator": {
      "description": "Output only. The email address of the user who created the session.",
      "readOnly": true,
      "type": "string"
    },
    "jupyterSession": {
      "$ref": "#/$defs/JupyterConfig",
      "description": "Optional. Jupyter session config."
    },
    "environmentConfig": {
      "$ref": "#/$defs/EnvironmentConfig",
      "description": "Optional. Environment configuration for the session execution."
    },
    "stateHistory": {
      "items": {
        "$ref": "#/$defs/SessionStateHistory"
      },
      "readOnly": true,
      "description": "Output only. Historical state information for the session.",
      "type": "array"
    },
    "stateTime": {
      "format": "google-datetime",
      "type": "string",
      "readOnly": true,
      "description": "Output only. The time when the session entered the current state."
    }
  },
  "type": "object",
  "$defs": {
    "AuthenticationConfig": {
      "properties": {
        "userWorkloadAuthenticationType": {
          "type": "string",
          "enum": [
            "AUTHENTICATION_TYPE_UNSPECIFIED",
            "SERVICE_ACCOUNT",
            "END_USER_CREDENTIALS"
          ],
          "description": "Optional. Authentication type for the user workload running in containers."
        }
      },
      "type": "object",
      "description": "Authentication configuration for a workload is used to set the default identity for the workload execution. The config specifies the type of identity (service account or user) that will be used by workloads to access resources on the project(s)."
    },
    "AutotuningConfig": {
      "type": "object",
      "description": "Autotuning configuration of the workload.",
      "properties": {
        "scenarios": {
          "items": {
            "type": "string",
            "enum": [
              "SCENARIO_UNSPECIFIED",
              "SCALING",
              "BROADCAST_HASH_JOIN",
              "MEMORY",
              "NONE",
              "AUTO"
            ]
          },
          "description": "Optional. Scenarios for which tunings are applied.",
          "type": "array"
        }
      }
    },
    "CohortInfo": {
      "properties": {
        "cohortSource": {
          "readOnly": true,
          "description": "Output only. Source of the cohort.",
          "type": "string",
          "enum": [
            "COHORT_SOURCE_UNSPECIFIED",
            "USER_PROVIDED",
            "AIRFLOW"
          ]
        },
        "cohort": {
          "description": "Output only. Final cohort that was used to tune the workload.",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object",
      "description": "Information about the cohort that the workload belongs to."
    },
    "EnvironmentConfig": {
      "description": "Environment configuration for a workload.",
      "properties": {
        "executionConfig": {
          "$ref": "#/$defs/ExecutionConfig",
          "description": "Optional. Execution configuration for a workload."
        },
        "peripheralsConfig": {
          "$ref": "#/$defs/PeripheralsConfig",
          "description": "Optional. Peripherals configuration that workload has access to."
        }
      },
      "type": "object"
    },
    "ExecutionConfig": {
      "properties": {
        "ttl": {
          "format": "google-duration",
          "type": "string",
          "description": "Optional. The duration after which the workload will be terminated, specified as the JSON representation for Duration (https://protobuf.dev/programming-guides/proto3/#json). When the workload exceeds this duration, it will be unconditionally terminated without waiting for ongoing work to finish. If ttl is not specified for a batch workload, the workload will be allowed to run until it exits naturally (or run forever without exiting). If ttl is not specified for an interactive session, it defaults to 24 hours. If ttl is not specified for a batch that uses 2.1+ runtime version, it defaults to 4 hours. Minimum value is 10 minutes; maximum value is 14 days. If both ttl and idle_ttl are specified (for an interactive session), the conditions are treated as OR conditions: the workload will be terminated when it has been idle for idle_ttl or when ttl has been exceeded, whichever occurs first."
        },
        "idleTtl": {
          "description": "Optional. Applies to sessions only. The duration to keep the session alive while it's idling. Exceeding this threshold causes the session to terminate. This field cannot be set on a batch workload. Minimum value is 10 minutes; maximum value is 14 days (see JSON representation of Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)). Defaults to 1 hour if not set. If both ttl and idle_ttl are specified for an interactive session, the conditions are treated as OR conditions: the workload will be terminated when it has been idle for idle_ttl or when ttl has been exceeded, whichever occurs first.",
          "type": "string",
          "format": "google-duration"
        },
        "resourceManagerTags": {
          "description": "Optional. Associates Resource Manager tags with the workload nodes. There is a max limit of 30 tags. Keys and values can be either in numeric format, such as tagKeys/{tag_key_id} and tagValues/{tag_value_id}, or in namespaced format, such as {org_id|project_id}/{tag_key_short_name} and {tag_value_short_name}.",
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "serviceAccount": {
          "description": "Optional. Service account that used to execute workload.",
          "type": "string"
        },
        "subnetworkUri": {
          "type": "string",
          "description": "Optional. Subnetwork URI to connect workload to."
        },
        "kmsKey": {
          "description": "Optional. The Cloud KMS key to use for encryption.",
          "type": "string"
        },
        "authenticationConfig": {
          "$ref": "#/$defs/AuthenticationConfig",
          "description": "Optional. Authentication configuration used to set the default identity for the workload execution. The config specifies the type of identity (service account or user) that will be used by workloads to access resources on the project(s)."
        },
        "stagingBucket": {
          "type": "string",
          "description": "Optional. A Cloud Storage bucket used to stage workload dependencies, config files, and store workload output and other ephemeral data, such as Spark history files. If you do not specify a staging bucket, Cloud Dataproc will determine a Cloud Storage location according to the region where your workload is running, and then create and manage project-level, per-location staging and temporary buckets. This field requires a Cloud Storage bucket name, not a gs://... URI to a Cloud Storage bucket."
        },
        "networkTags": {
          "description": "Optional. Tags used for network traffic control.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "networkUri": {
          "description": "Optional. Network URI to connect workload to.",
          "type": "string"
        }
      },
      "description": "Execution configuration for a workload.",
      "type": "object"
    },
    "JupyterConfig": {
      "properties": {
        "kernel": {
          "description": "Optional. Kernel",
          "type": "string",
          "enum": [
            "KERNEL_UNSPECIFIED",
            "PYTHON",
            "SCALA"
          ]
        },
        "displayName": {
          "description": "Optional. Display name, shown in the Jupyter kernelspec card.",
          "type": "string"
        }
      },
      "type": "object",
      "description": "Jupyter configuration for an interactive session."
    },
    "PeripheralsConfig": {
      "type": "object",
      "description": "Auxiliary services configuration for a workload.",
      "properties": {
        "metastoreService": {
          "type": "string",
          "description": "Optional. Resource name of an existing Dataproc Metastore service.Example: projects/[project_id]/locations/[region]/services/[service_id]"
        },
        "sparkHistoryServerConfig": {
          "$ref": "#/$defs/SparkHistoryServerConfig",
          "description": "Optional. The Spark History Server configuration for the workload."
        }
      }
    },
    "PropertiesInfo": {
      "type": "object",
      "description": "Properties of the workload organized by origin.",
      "properties": {
        "autotuningProperties": {
          "description": "Output only. Properties set by autotuning engine.",
          "readOnly": true,
          "additionalProperties": {
            "$ref": "#/$defs/ValueInfo"
          },
          "type": "object"
        }
      }
    },
    "PyPiRepositoryConfig": {
      "type": "object",
      "description": "Configuration for PyPi repository",
      "properties": {
        "pypiRepository": {
          "description": "Optional. The PyPi repository address. Note: This field is not available for batch workloads.",
          "type": "string"
        }
      }
    },
    "RepositoryConfig": {
      "type": "object",
      "properties": {
        "pypiRepositoryConfig": {
          "$ref": "#/$defs/PyPiRepositoryConfig",
          "description": "Optional. Configuration for PyPi repository."
        }
      },
      "description": "Configuration for dependency repositories"
    },
    "RuntimeConfig": {
      "properties": {
        "properties": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "Optional. A mapping of property names to values, which are used to configure workload execution."
        },
        "repositoryConfig": {
          "$ref": "#/$defs/RepositoryConfig",
          "description": "Optional. Dependency repository configuration."
        },
        "containerImage": {
          "description": "Optional. Optional custom container image for the job runtime environment. If not specified, a default container image will be used.",
          "type": "string"
        },
        "version": {
          "description": "Optional. Version of the batch runtime.",
          "type": "string"
        },
        "autotuningConfig": {
          "$ref": "#/$defs/AutotuningConfig",
          "description": "Optional. Autotuning configuration of the workload."
        },
        "cohort": {
          "type": "string",
          "description": "Optional. Cohort identifier. Identifies families of the workloads that have the same shape, for example, daily ETL jobs."
        }
      },
      "type": "object",
      "description": "Runtime configuration for a workload."
    },
    "RuntimeInfo": {
      "type": "object",
      "properties": {
        "approximateUsage": {
          "$ref": "#/$defs/UsageMetrics",
          "description": "Output only. Approximate workload resource usage, calculated when the workload completes (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).Note: This metric calculation may change in the future, for example, to capture cumulative workload resource consumption during workload execution (see the Dataproc Serverless release notes (https://cloud.google.com/dataproc-serverless/docs/release-notes) for announcements, changes, fixes and other Dataproc developments)."
        },
        "cohortInfo": {
          "$ref": "#/$defs/CohortInfo",
          "description": "Output only. Information about the cohort that the workload belongs to."
        },
        "propertiesInfo": {
          "$ref": "#/$defs/PropertiesInfo",
          "description": "Optional. Properties of the workload organized by origin."
        },
        "currentUsage": {
          "$ref": "#/$defs/UsageSnapshot",
          "description": "Output only. Snapshot of current workload resource usage."
        },
        "outputUri": {
          "readOnly": true,
          "type": "string",
          "description": "Output only. A URI pointing to the location of the stdout and stderr of the workload."
        },
        "diagnosticOutputUri": {
          "readOnly": true,
          "description": "Output only. A URI pointing to the location of the diagnostics tarball.",
          "type": "string"
        },
        "endpoints": {
          "readOnly": true,
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "Output only. Map of remote access endpoints (such as web interfaces and APIs) to their URIs."
        }
      },
      "description": "Runtime information about workload execution."
    },
    "SessionStateHistory": {
      "properties": {
        "stateStartTime": {
          "description": "Output only. The time when the session entered the historical state.",
          "type": "string",
          "readOnly": true,
          "format": "google-datetime"
        },
        "stateMessage": {
          "description": "Output only. Details about the state at this point in the session history.",
          "type": "string",
          "readOnly": true
        },
        "state": {
          "readOnly": true,
          "description": "Output only. The state of the session at this point in the session history.",
          "type": "string",
          "enum": [
            "STATE_UNSPECIFIED",
            "CREATING",
            "ACTIVE",
            "TERMINATING",
            "TERMINATED",
            "FAILED"
          ]
        }
      },
      "type": "object",
      "description": "Historical state information."
    },
    "SparkConnectConfig": {
      "description": "Spark connect configuration for an interactive session.",
      "type": "object",
      "properties": {}
    },
    "SparkHistoryServerConfig": {
      "properties": {
        "dataprocCluster": {
          "type": "string",
          "description": "Optional. Resource name of an existing Dataproc Cluster to act as a Spark History Server for the workload.Example: projects/[project_id]/regions/[region]/clusters/[cluster_name]"
        }
      },
      "type": "object",
      "description": "Spark History Server configuration for the workload."
    },
    "UsageMetrics": {
      "description": "Usage metrics represent approximate total resources consumed by a workload.",
      "properties": {
        "shuffleStorageGbSeconds": {
          "format": "int64",
          "type": "string",
          "description": "Optional. Shuffle storage usage in (GB x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))."
        },
        "acceleratorType": {
          "type": "string",
          "description": "Optional. Accelerator type being used, if any Deprecated: This field is only used in runtime versions below 3.0."
        },
        "milliAcceleratorSecondsL4": {
          "format": "int64",
          "description": "Optional. L4 accelerator usage in (milliAccelerator x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).",
          "type": "string"
        },
        "milliAcceleratorSecondsA10040": {
          "type": "string",
          "description": "Optional. A100-40 accelerator usage in (milliAccelerator x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).",
          "format": "int64"
        },
        "updateTime": {
          "description": "Optional. The timestamp of the usage metrics.",
          "format": "google-datetime",
          "type": "string"
        },
        "milliAcceleratorSeconds": {
          "format": "int64",
          "description": "Optional. Accelerator usage in (milliAccelerator x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)). Deprecated: This field is only used in runtime versions below 3.0.",
          "type": "string"
        },
        "milliAcceleratorSecondsA10080": {
          "type": "string",
          "format": "int64",
          "description": "Optional. A100-80 accelerator usage in (milliAccelerator x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))."
        },
        "milliDcuSeconds": {
          "format": "int64",
          "type": "string",
          "description": "Optional. DCU (Dataproc Compute Units) usage in (milliDCU x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))."
        }
      },
      "type": "object"
    },
    "UsageSnapshot": {
      "description": "The usage snapshot represents the resources consumed by a workload at a specified time.",
      "type": "object",
      "properties": {
        "milliAcceleratorA10080": {
          "format": "int64",
          "type": "string",
          "description": "Optional. Milli (one-thousandth) accelerator for A100-80 accelerators. (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))"
        },
        "milliAcceleratorL4": {
          "type": "string",
          "description": "Optional. Milli (one-thousandth) accelerator for L4 accelerators. (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))",
          "format": "int64"
        },
        "milliDcuPremium": {
          "type": "string",
          "format": "int64",
          "description": "Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at premium tier (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))."
        },
        "shuffleStorageGb": {
          "description": "Optional. Shuffle Storage in gigabytes (GB). (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))",
          "format": "int64",
          "type": "string"
        },
        "milliDcu": {
          "type": "string",
          "description": "Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).",
          "format": "int64"
        },
        "acceleratorType": {
          "type": "string",
          "description": "Optional. Accelerator type being used, if any Deprecated: This field is only used in runtime versions below 3.0."
        },
        "milliAccelerator": {
          "format": "int64",
          "type": "string",
          "description": "Optional. Milli (one-thousandth) accelerator. (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)) Deprecated: This field is only used in runtime versions below 3.0."
        },
        "snapshotTime": {
          "type": "string",
          "description": "Optional. The timestamp of the usage snapshot.",
          "format": "google-datetime"
        },
        "milliAcceleratorA10040": {
          "description": "Optional. Milli (one-thousandth) accelerator for A100-40 accelerators. (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))",
          "format": "int64",
          "type": "string"
        },
        "shuffleStorageGbPremium": {
          "format": "int64",
          "type": "string",
          "description": "Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))"
        }
      }
    },
    "ValueInfo": {
      "description": "Annotatated property value.",
      "type": "object",
      "properties": {
        "value": {
          "description": "Property value.",
          "type": "string"
        },
        "annotation": {
          "description": "Annotation, comment or explanation why the property was set.",
          "type": "string"
        },
        "overriddenValue": {
          "type": "string",
          "description": "Optional. Value which was replaced by the corresponding component."
        }
      }
    }
  }
}