<filename>argo_dsl/api/io/argoproj/workflow/v1alpha1.py
# generated by datamodel-codegen:
#   filename:  https://raw.githubusercontent.com/argoproj/argo-workflows/stable/api/openapi-spec/swagger.json

from __future__ import annotations

from typing import Any
from typing import Dict
from typing import List
from typing import Optional

from pydantic import BaseModel
from pydantic import Field

from ...k8s.api.core import v1
from ...k8s.api.policy import v1beta1
from ...k8s.apimachinery.pkg.apis.meta import v1 as v1_1
from ...k8s.apimachinery.pkg.util import intstr


class Amount(BaseModel):
    __root__: float = Field(..., description="Amount represent a numeric amount.")


class ArchivedWorkflowDeletedResponse(BaseModel):
    pass


class ArtifactRepositoryRef(BaseModel):
    configMap: Optional[str] = Field(
        None,
        description='The name of the config map. Defaults to "artifact-repositories".',
    )
    key: Optional[str] = Field(
        None,
        description='The config map key. Defaults to the value of the "workflows.argoproj.io/default-artifact-repository" annotation.',
    )


class ArtifactRepositoryRefStatus(BaseModel):
    configMap: Optional[str] = Field(
        None,
        description='The name of the config map. Defaults to "artifact-repositories".',
    )
    default: Optional[bool] = Field(
        None,
        description="If this ref represents the default artifact repository, rather than a config map.",
    )
    key: Optional[str] = Field(
        None,
        description='The config map key. Defaults to the value of the "workflows.argoproj.io/default-artifact-repository" annotation.',
    )
    namespace: Optional[str] = Field(
        None,
        description="The namespace of the config map. Defaults to the workflow's namespace, or the controller's namespace (if found).",
    )


class ClusterWorkflowTemplateDeleteResponse(BaseModel):
    pass


class Condition(BaseModel):
    message: Optional[str] = Field(None, description="Message is the condition message")
    status: Optional[str] = Field(
        None, description="Status is the status of the condition"
    )
    type: Optional[str] = Field(None, description="Type is the type of condition")


class ContinueOn(BaseModel):
    error: Optional[bool] = None
    failed: Optional[bool] = None


class Counter(BaseModel):
    value: str = Field(..., description="Value is the value of the metric")


class CreateS3BucketOptions(BaseModel):
    objectLocking: Optional[bool] = Field(
        None, description="ObjectLocking Enable object locking"
    )


class CronWorkflowDeletedResponse(BaseModel):
    pass


class CronWorkflowResumeRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class CronWorkflowSuspendRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class Event(BaseModel):
    selector: str = Field(
        ...,
        description='Selector (https://github.com/antonmedv/expr) that we must must match the io.argoproj.workflow.v1alpha1. E.g. `payload.message == "test"`',
    )


class EventResponse(BaseModel):
    pass


class ExecutorConfig(BaseModel):
    serviceAccountName: Optional[str] = Field(
        None,
        description="ServiceAccountName specifies the service account name of the executor container.",
    )


class Gauge(BaseModel):
    realtime: bool = Field(
        ..., description="Realtime emits this metric in real time if applicable"
    )
    value: str = Field(..., description="Value is the value of the metric")


class GetUserInfoResponse(BaseModel):
    email: Optional[str] = None
    emailVerified: Optional[bool] = None
    groups: Optional[List[str]] = None
    issuer: Optional[str] = None
    serviceAccountName: Optional[str] = None
    subject: Optional[str] = None


class Header(BaseModel):
    name: str = Field(..., description="Name is the header name")
    value: str = Field(
        ..., description="Value is the literal value to use for the header"
    )


class Histogram(BaseModel):
    buckets: List[Amount] = Field(
        ..., description="Buckets is a list of bucket divisors for the histogram"
    )
    value: str = Field(..., description="Value is the value of the metric")


class Item(BaseModel):
    __root__: Any = Field(
        ...,
        description="Item expands a single workflow step into multiple parallel steps The value of Item can be a map, string, bool, or number",
    )


class Link(BaseModel):
    name: str = Field(
        ..., description='The name of the link, E.g. "Workflow Logs" or "Pod Logs"'
    )
    scope: str = Field(..., description='Either "workflow" or "pod"')
    url: str = Field(
        ...,
        description='The URL. May contain "${metadata.namespace}", "${metadata.name}", "${status.startedAt}" and "${status.finishedAt}".',
    )


class LogEntry(BaseModel):
    content: Optional[str] = None
    podName: Optional[str] = None


class MemoizationStatus(BaseModel):
    cacheName: str = Field(
        ..., description="Cache is the name of the cache that was used"
    )
    hit: bool = Field(
        ...,
        description="Hit indicates whether this node was created from a cache entry",
    )
    key: str = Field(
        ..., description="Key is the name of the key used for this node's cache"
    )


class Metadata(BaseModel):
    annotations: Optional[Dict[str, str]] = None
    labels: Optional[Dict[str, str]] = None


class MetricLabel(BaseModel):
    key: str
    value: str


class Mutex(BaseModel):
    name: Optional[str] = Field(None, description="name of the mutex")


class MutexHolding(BaseModel):
    holder: Optional[str] = Field(
        None,
        description="Holder is a reference to the object which holds the Mutex. Holding Scenario:\n  1. Current workflow's NodeID which is holding the lock.\n     e.g: ${NodeID}\nWaiting Scenario:\n  1. Current workflow or other workflow NodeID which is holding the lock.\n     e.g: ${WorkflowName}/${NodeID}",
    )
    mutex: Optional[str] = Field(
        None, description="Reference for the mutex e.g: ${namespace}/mutex/${mutexName}"
    )


class MutexStatus(BaseModel):
    holding: Optional[List[MutexHolding]] = Field(
        None,
        description="Holding is a list of mutexes and their respective objects that are held by mutex lock for this io.argoproj.workflow.v1alpha1.",
    )
    waiting: Optional[List[MutexHolding]] = Field(
        None,
        description="Waiting is a list of mutexes and their respective objects this workflow is waiting for.",
    )


class NodeSynchronizationStatus(BaseModel):
    waiting: Optional[str] = Field(
        None,
        description="Waiting is the name of the lock that this node is waiting for",
    )


class NoneStrategy(BaseModel):
    pass


class Prometheus(BaseModel):
    counter: Optional[Counter] = Field(None, description="Counter is a counter metric")
    gauge: Optional[Gauge] = Field(None, description="Gauge is a gauge metric")
    help: str = Field(..., description="Help is a string that describes the metric")
    histogram: Optional[Histogram] = Field(
        None, description="Histogram is a histogram metric"
    )
    labels: Optional[List[MetricLabel]] = Field(
        None, description="Labels is a list of metric labels"
    )
    name: str = Field(..., description="Name is the name of the metric")
    when: Optional[str] = Field(
        None,
        description="When is a conditional statement that decides when to emit the metric",
    )


class RawArtifact(BaseModel):
    data: str = Field(..., description="Data is the string contents of the artifact")


class ResourceTemplate(BaseModel):
    action: str = Field(
        ...,
        description="Action is the action to perform to the resource. Must be one of: get, create, apply, delete, replace, patch",
    )
    failureCondition: Optional[str] = Field(
        None,
        description="FailureCondition is a label selector expression which describes the conditions of the k8s resource in which the step was considered failed",
    )
    flags: Optional[List[str]] = Field(
        None,
        description='Flags is a set of additional options passed to kubectl before submitting a resource I.e. to disable resource validation: flags: [\n\t"--validate=false"  # disable resource validation\n]',
    )
    manifest: Optional[str] = Field(
        None, description="Manifest contains the kubernetes manifest"
    )
    mergeStrategy: Optional[str] = Field(
        None,
        description='MergeStrategy is the strategy used to merge a patch. It defaults to "strategic" Must be one of: strategic, merge, json',
    )
    setOwnerReference: Optional[bool] = Field(
        None,
        description="SetOwnerReference sets the reference to the workflow on the OwnerReference of generated resource.",
    )
    successCondition: Optional[str] = Field(
        None,
        description="SuccessCondition is a label selector expression which describes the conditions of the k8s resource in which it is acceptable to proceed to the following step",
    )


class RetryNodeAntiAffinity(BaseModel):
    pass


class SemaphoreHolding(BaseModel):
    holders: Optional[List[str]] = Field(
        None,
        description="Holders stores the list of current holder names in the io.argoproj.workflow.v1alpha1.",
    )
    semaphore: Optional[str] = Field(
        None, description="Semaphore stores the semaphore name."
    )


class SemaphoreStatus(BaseModel):
    holding: Optional[List[SemaphoreHolding]] = Field(
        None,
        description="Holding stores the list of resource acquired synchronization lock for workflows.",
    )
    waiting: Optional[List[SemaphoreHolding]] = Field(
        None,
        description="Waiting indicates the list of current synchronization lock holders.",
    )


class SuppliedValueFrom(BaseModel):
    pass


class SuspendTemplate(BaseModel):
    duration: Optional[str] = Field(
        None,
        description="Duration is the seconds to wait before automatically resuming a template",
    )


class SynchronizationStatus(BaseModel):
    mutex: Optional[MutexStatus] = Field(
        None, description="Mutex stores this workflow's mutex holder details"
    )
    semaphore: Optional[SemaphoreStatus] = Field(
        None, description="Semaphore stores this workflow's Semaphore holder details"
    )


class TTLStrategy(BaseModel):
    secondsAfterCompletion: Optional[int] = Field(
        None,
        description="SecondsAfterCompletion is the number of seconds to live after completion",
    )
    secondsAfterFailure: Optional[int] = Field(
        None,
        description="SecondsAfterFailure is the number of seconds to live after failure",
    )
    secondsAfterSuccess: Optional[int] = Field(
        None,
        description="SecondsAfterSuccess is the number of seconds to live after success",
    )


class TarStrategy(BaseModel):
    compressionLevel: Optional[int] = Field(
        None,
        description="CompressionLevel specifies the gzip compression level to use for the artifact. Defaults to gzip.DefaultCompression.",
    )


class TemplateRef(BaseModel):
    clusterScope: Optional[bool] = Field(
        None,
        description="ClusterScope indicates the referred template is cluster scoped (i.e. a ClusterWorkflowTemplate).",
    )
    name: Optional[str] = Field(
        None, description="Name is the resource name of the template."
    )
    template: Optional[str] = Field(
        None, description="Template is the name of referred template in the resource."
    )


class ValueFrom(BaseModel):
    default: Optional[str] = Field(
        None,
        description="Default specifies a value to be used if retrieving the value from the specified source fails",
    )
    event: Optional[str] = Field(
        None,
        description="Selector (https://github.com/antonmedv/expr) that is evaluated against the event to get the value of the parameter. E.g. `payload.message`",
    )
    jqFilter: Optional[str] = Field(
        None,
        description="JQFilter expression against the resource object in resource templates",
    )
    jsonPath: Optional[str] = Field(
        None,
        description="JSONPath of a resource to retrieve an output parameter value from in resource templates",
    )
    parameter: Optional[str] = Field(
        None,
        description="Parameter reference to a step or dag task in which to retrieve an output parameter value from (e.g. '{{steps.mystep.outputs.myparam}}')",
    )
    path: Optional[str] = Field(
        None,
        description="Path in the container to retrieve an output parameter value from in container templates",
    )
    supplied: Optional[SuppliedValueFrom] = Field(
        None,
        description="Supplied value to be filled in directly, either through the CLI, API, etc.",
    )


class Version(BaseModel):
    buildDate: str
    compiler: str
    gitCommit: str
    gitTag: str
    gitTreeState: str
    goVersion: str
    platform: str
    version: str


class VolumeClaimGC(BaseModel):
    strategy: Optional[str] = Field(
        None,
        description='Strategy is the strategy to use. One of "OnWorkflowCompletion", "OnWorkflowSuccess"',
    )


class WorkflowDeleteResponse(BaseModel):
    pass


class WorkflowResubmitRequest(BaseModel):
    memoized: Optional[bool] = None
    name: Optional[str] = None
    namespace: Optional[str] = None


class WorkflowResumeRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None


class WorkflowRetryRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None
    restartSuccessful: Optional[bool] = None


class WorkflowSetRequest(BaseModel):
    message: Optional[str] = None
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None
    outputParameters: Optional[str] = None
    phase: Optional[str] = None


class WorkflowStopRequest(BaseModel):
    message: Optional[str] = None
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None


class WorkflowSuspendRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class WorkflowTemplateDeleteResponse(BaseModel):
    pass


class WorkflowTemplateRef(BaseModel):
    clusterScope: Optional[bool] = Field(
        None,
        description="ClusterScope indicates the referred template is cluster scoped (i.e. a ClusterWorkflowTemplate).",
    )
    name: Optional[str] = Field(
        None, description="Name is the resource name of the workflow template."
    )


class WorkflowTerminateRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class ZipStrategy(BaseModel):
    pass


class ArchiveStrategy(BaseModel):
    none: Optional[NoneStrategy] = None
    tar: Optional[TarStrategy] = None
    zip: Optional[ZipStrategy] = None


class ArtifactoryArtifact(BaseModel):
    passwordSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="PasswordSecret is the secret selector to the repository password",
    )
    url: str = Field(..., description="URL of the artifact")
    usernameSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="UsernameSecret is the secret selector to the repository username",
    )


class Backoff(BaseModel):
    duration: Optional[str] = Field(
        None,
        description='Duration is the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h")',
    )
    factor: Optional[intstr.IntOrString] = Field(
        None,
        description="Factor is a factor to multiply the base duration after each failed retry",
    )
    maxDuration: Optional[str] = Field(
        None,
        description="MaxDuration is the maximum amount of time allowed for the backoff strategy",
    )


class Cache(BaseModel):
    configMap: v1.ConfigMapKeySelector = Field(
        ..., description="ConfigMap sets a ConfigMap-based cache"
    )


class CronWorkflowStatus(BaseModel):
    active: List[v1.ObjectReference] = Field(
        ...,
        description="Active is a list of active workflows stemming from this CronWorkflow",
    )
    conditions: List[Condition] = Field(
        ..., description="Conditions is a list of conditions the CronWorkflow may have"
    )
    lastScheduledTime: v1_1.Time = Field(
        ...,
        description="LastScheduleTime is the last time the CronWorkflow was scheduled",
    )


class GCSArtifact(BaseModel):
    bucket: Optional[str] = Field(None, description="Bucket is the name of the bucket")
    key: str = Field(
        ..., description="Key is the path in the bucket where the artifact resides"
    )
    serviceAccountKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="ServiceAccountKeySecret is the secret selector to the bucket's service account key",
    )


class GitArtifact(BaseModel):
    depth: Optional[int] = Field(
        None,
        description="Depth specifies clones/fetches should be shallow and include the given number of commits from the branch tip",
    )
    fetch: Optional[List[str]] = Field(
        None,
        description="Fetch specifies a number of refs that should be fetched before checkout",
    )
    insecureIgnoreHostKey: Optional[bool] = Field(
        None,
        description="InsecureIgnoreHostKey disables SSH strict host key checking during git clone",
    )
    passwordSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="PasswordSecret is the secret selector to the repository password",
    )
    repo: str = Field(..., description="Repo is the git repository")
    revision: Optional[str] = Field(
        None, description="Revision is the git commit, tag, branch to checkout"
    )
    sshPrivateKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="SSHPrivateKeySecret is the secret selector to the repository ssh private key",
    )
    usernameSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="UsernameSecret is the secret selector to the repository username",
    )


class HDFSArtifact(BaseModel):
    addresses: Optional[List[str]] = Field(
        None, description="Addresses is accessible addresses of HDFS name nodes"
    )
    force: Optional[bool] = Field(
        None,
        description="Force copies a file forcibly even if it exists (default: false)",
    )
    hdfsUser: Optional[str] = Field(
        None,
        description="HDFSUser is the user to access HDFS file system. It is ignored if either ccache or keytab is used.",
    )
    krbCCacheSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="KrbCCacheSecret is the secret selector for Kerberos ccache Either ccache or keytab can be set to use Kerberos.",
    )
    krbConfigConfigMap: Optional[v1.ConfigMapKeySelector] = Field(
        None,
        description="KrbConfig is the configmap selector for Kerberos config as string It must be set if either ccache or keytab is used.",
    )
    krbKeytabSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="KrbKeytabSecret is the secret selector for Kerberos keytab Either ccache or keytab can be set to use Kerberos.",
    )
    krbRealm: Optional[str] = Field(
        None,
        description="KrbRealm is the Kerberos realm used with Kerberos keytab It must be set if keytab is used.",
    )
    krbServicePrincipalName: Optional[str] = Field(
        None,
        description="KrbServicePrincipalName is the principal name of Kerberos service It must be set if either ccache or keytab is used.",
    )
    krbUsername: Optional[str] = Field(
        None,
        description="KrbUsername is the Kerberos username used with Kerberos keytab It must be set if keytab is used.",
    )
    path: str = Field(..., description="Path is a file path in HDFS")


class HTTPArtifact(BaseModel):
    headers: Optional[List[Header]] = Field(
        None,
        description="Headers are an optional list of headers to send with HTTP requests for artifacts",
    )
    url: str = Field(..., description="URL of the artifact")


class InfoResponse(BaseModel):
    links: Optional[List[Link]] = None
    managedNamespace: Optional[str] = None


class Memoize(BaseModel):
    cache: Cache = Field(..., description="Cache sets and configures the kind of cache")
    key: str = Field(..., description="Key is the key to use as the caching key")
    maxAge: str = Field(
        ...,
        description='MaxAge is the maximum age (e.g. "180s", "24h") of an entry that is still considered valid. If an entry is older than the MaxAge, it will be ignored.',
    )


class Metrics(BaseModel):
    prometheus: List[Prometheus] = Field(
        ..., description="Prometheus is a list of prometheus metrics to be emitted"
    )


class OSSArtifact(BaseModel):
    accessKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="AccessKeySecret is the secret selector to the bucket's access key",
    )
    bucket: Optional[str] = Field(None, description="Bucket is the name of the bucket")
    createBucketIfNotPresent: Optional[bool] = Field(
        None,
        description="CreateBucketIfNotPresent tells the driver to attempt to create the OSS bucket for output artifacts, if it doesn't exist",
    )
    endpoint: Optional[str] = Field(
        None, description="Endpoint is the hostname of the bucket endpoint"
    )
    key: str = Field(
        ..., description="Key is the path in the bucket where the artifact resides"
    )
    secretKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="SecretKeySecret is the secret selector to the bucket's secret key",
    )


class Parameter(BaseModel):
    default: Optional[str] = Field(
        None,
        description="Default is the default value to use for an input parameter if a value was not supplied",
    )
    enum: Optional[List[str]] = Field(
        None,
        description="Enum holds a list of string values to choose from, for the actual value of the parameter",
    )
    globalName: Optional[str] = Field(
        None,
        description="GlobalName exports an output parameter to the global scope, making it available as '{{io.argoproj.workflow.v1alpha1.outputs.parameters.XXXX}} and in workflow.status.outputs.parameters",
    )
    name: str = Field(..., description="Name is the parameter name")
    value: Optional[str] = Field(
        None,
        description="Value is the literal value to use for the parameter. If specified in the context of an input parameter, the value takes precedence over any passed values",
    )
    valueFrom: Optional[ValueFrom] = Field(
        None, description="ValueFrom is the source for the output parameter's value"
    )


class RetryAffinity(BaseModel):
    nodeAntiAffinity: Optional[RetryNodeAntiAffinity] = None


class RetryStrategy(BaseModel):
    affinity: Optional[RetryAffinity] = Field(
        None, description="Affinity prevents running workflow's step on the same host"
    )
    backoff: Optional[Backoff] = Field(
        None, description="Backoff is a backoff strategy"
    )
    limit: Optional[intstr.IntOrString] = Field(
        None,
        description="Limit is the maximum number of attempts when retrying a container",
    )
    retryPolicy: Optional[str] = Field(
        None,
        description="RetryPolicy is a policy of NodePhase statuses that will be retried",
    )


class S3Artifact(BaseModel):
    accessKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="AccessKeySecret is the secret selector to the bucket's access key",
    )
    bucket: Optional[str] = Field(None, description="Bucket is the name of the bucket")
    createBucketIfNotPresent: Optional[CreateS3BucketOptions] = Field(
        None,
        description="CreateBucketIfNotPresent tells the driver to attempt to create the S3 bucket for output artifacts, if it doesn't exist",
    )
    endpoint: Optional[str] = Field(
        None, description="Endpoint is the hostname of the bucket endpoint"
    )
    insecure: Optional[bool] = Field(
        None, description="Insecure will connect to the service with TLS"
    )
    key: str = Field(
        ..., description="Key is the key in the bucket where the artifact resides"
    )
    region: Optional[str] = Field(
        None, description="Region contains the optional bucket region"
    )
    roleARN: Optional[str] = Field(
        None,
        description="RoleARN is the Amazon Resource Name (ARN) of the role to assume.",
    )
    secretKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="SecretKeySecret is the secret selector to the bucket's secret key",
    )
    useSDKCreds: Optional[bool] = Field(
        None,
        description="UseSDKCreds tells the driver to figure out credentials based on sdk defaults.",
    )


class SemaphoreRef(BaseModel):
    configMapKeyRef: Optional[v1.ConfigMapKeySelector] = Field(
        None,
        description="ConfigMapKeyRef is configmap selector for Semaphore configuration",
    )


class Sequence(BaseModel):
    count: Optional[intstr.IntOrString] = Field(
        None,
        description="Count is number of elements in the sequence (default: 0). Not to be used with end",
    )
    end: Optional[intstr.IntOrString] = Field(
        None,
        description="Number at which to end the sequence (default: 0). Not to be used with Count",
    )
    format: Optional[str] = Field(
        None,
        description="Format is a printf format string to format the value in the sequence",
    )
    start: Optional[intstr.IntOrString] = Field(
        None, description="Number at which to start the sequence (default: 0)"
    )


class SubmitOpts(BaseModel):
    annotations: Optional[str] = Field(
        None, description="Annotations adds to metadata.labels"
    )
    dryRun: Optional[bool] = Field(
        None,
        description="DryRun validates the workflow on the client-side without creating it. This option is not supported in API",
    )
    entryPoint: Optional[str] = Field(
        None, description="Entrypoint overrides spec.entrypoint"
    )
    generateName: Optional[str] = Field(
        None, description="GenerateName overrides metadata.generateName"
    )
    labels: Optional[str] = Field(None, description="Labels adds to metadata.labels")
    name: Optional[str] = Field(None, description="Name overrides metadata.name")
    ownerReference: Optional[v1_1.OwnerReference] = Field(
        None, description="OwnerReference creates a metadata.ownerReference"
    )
    parameterFile: Optional[str] = Field(
        None,
        description="ParameterFile holds a reference to a parameter file. This option is not supported in API",
    )
    parameters: Optional[List[str]] = Field(
        None, description="Parameters passes input parameters to workflow"
    )
    serverDryRun: Optional[bool] = Field(
        None,
        description="ServerDryRun validates the workflow on the server-side without creating it",
    )
    serviceAccount: Optional[str] = Field(
        None,
        description="ServiceAccount runs all pods in the workflow using specified ServiceAccount.",
    )


class Synchronization(BaseModel):
    mutex: Optional[Mutex] = Field(
        None, description="Mutex holds the Mutex lock details"
    )
    semaphore: Optional[SemaphoreRef] = Field(
        None, description="Semaphore holds the Semaphore configuration"
    )


class WorkflowSubmitRequest(BaseModel):
    namespace: Optional[str] = None
    resourceKind: Optional[str] = None
    resourceName: Optional[str] = None
    submitOptions: Optional[SubmitOpts] = None


class Artifact(BaseModel):
    archive: Optional[ArchiveStrategy] = Field(
        None,
        description="Archive controls how the artifact will be saved to the artifact repository.",
    )
    archiveLogs: Optional[bool] = Field(
        None,
        description="ArchiveLogs indicates if the container logs should be archived",
    )
    artifactory: Optional[ArtifactoryArtifact] = Field(
        None, description="Artifactory contains artifactory artifact location details"
    )
    from_: Optional[str] = Field(
        None,
        alias="from",
        description="From allows an artifact to reference an artifact from a previous step",
    )
    gcs: Optional[GCSArtifact] = Field(
        None, description="GCS contains GCS artifact location details"
    )
    git: Optional[GitArtifact] = Field(
        None, description="Git contains git artifact location details"
    )
    globalName: Optional[str] = Field(
        None,
        description="GlobalName exports an output artifact to the global scope, making it available as '{{io.argoproj.workflow.v1alpha1.outputs.artifacts.XXXX}} and in workflow.status.outputs.artifacts",
    )
    hdfs: Optional[HDFSArtifact] = Field(
        None, description="HDFS contains HDFS artifact location details"
    )
    http: Optional[HTTPArtifact] = Field(
        None, description="HTTP contains HTTP artifact location details"
    )
    mode: Optional[int] = Field(
        None,
        description="mode bits to use on this file, must be a value between 0 and 0777 set when loading input artifacts.",
    )
    name: str = Field(
        ...,
        description="name of the artifact. must be unique within a template's inputs/outputs.",
    )
    optional: Optional[bool] = Field(
        None,
        description="Make Artifacts optional, if Artifacts doesn't generate or exist",
    )
    oss: Optional[OSSArtifact] = Field(
        None, description="OSS contains OSS artifact location details"
    )
    path: Optional[str] = Field(
        None, description="Path is the container path to the artifact"
    )
    raw: Optional[RawArtifact] = Field(
        None, description="Raw contains raw artifact location details"
    )
    recurseMode: Optional[bool] = Field(
        None,
        description="If mode is set, apply the permission recursively into the artifact if it is a folder",
    )
    s3: Optional[S3Artifact] = Field(
        None, description="S3 contains S3 artifact location details"
    )
    subPath: Optional[str] = Field(
        None,
        description="SubPath allows an artifact to be sourced from a subpath within the specified source",
    )


class ArtifactLocation(BaseModel):
    archiveLogs: Optional[bool] = Field(
        None,
        description="ArchiveLogs indicates if the container logs should be archived",
    )
    artifactory: Optional[ArtifactoryArtifact] = Field(
        None, description="Artifactory contains artifactory artifact location details"
    )
    gcs: Optional[GCSArtifact] = Field(
        None, description="GCS contains GCS artifact location details"
    )
    git: Optional[GitArtifact] = Field(
        None, description="Git contains git artifact location details"
    )
    hdfs: Optional[HDFSArtifact] = Field(
        None, description="HDFS contains HDFS artifact location details"
    )
    http: Optional[HTTPArtifact] = Field(
        None, description="HTTP contains HTTP artifact location details"
    )
    oss: Optional[OSSArtifact] = Field(
        None, description="OSS contains OSS artifact location details"
    )
    raw: Optional[RawArtifact] = Field(
        None, description="Raw contains raw artifact location details"
    )
    s3: Optional[S3Artifact] = Field(
        None, description="S3 contains S3 artifact location details"
    )


class Inputs(BaseModel):
    artifacts: Optional[List[Artifact]] = Field(
        None, description="Artifact are a list of artifacts passed as inputs"
    )
    parameters: Optional[List[Parameter]] = Field(
        None, description="Parameters are a list of parameters passed as inputs"
    )


class Outputs(BaseModel):
    artifacts: Optional[List[Artifact]] = Field(
        None,
        description="Artifacts holds the list of output artifacts produced by a step",
    )
    exitCode: Optional[str] = Field(
        None, description="ExitCode holds the exit code of a script template"
    )
    parameters: Optional[List[Parameter]] = Field(
        None,
        description="Parameters holds the list of output parameters produced by a step",
    )
    result: Optional[str] = Field(
        None, description="Result holds the result (stdout) of a script template"
    )


class PodGC(BaseModel):
    labelSelector: Optional[v1_1.LabelSelector] = Field(
        None,
        description="LabelSelector is the label selector to check if the pods match the labels before being added to the pod GC queue.",
    )
    strategy: Optional[str] = Field(
        None,
        description='Strategy is the strategy to use. One of "OnPodCompletion", "OnPodSuccess", "OnWorkflowCompletion", "OnWorkflowSuccess"',
    )


class Arguments(BaseModel):
    artifacts: Optional[List[Artifact]] = Field(
        None,
        description="Artifacts is the list of artifacts to pass to the template or workflow",
    )
    parameters: Optional[List[Parameter]] = Field(
        None,
        description="Parameters is the list of parameters to pass to the template or workflow",
    )


class DAGTask(BaseModel):
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments are the parameter and artifact arguments to the template",
    )
    continueOn: Optional[ContinueOn] = Field(
        None,
        description="ContinueOn makes argo to proceed with the following step even if this step fails. Errors and Failed states can be specified",
    )
    dependencies: Optional[List[str]] = Field(
        None, description="Dependencies are name of other targets which this depends on"
    )
    depends: Optional[str] = Field(
        None, description="Depends are name of other targets which this depends on"
    )
    name: str = Field(..., description="Name is the name of the target")
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the template, irrespective of the success, failure, or error of the primary template.",
    )
    template: Optional[str] = Field(None, description="Name of template to execute")
    templateRef: Optional[TemplateRef] = Field(
        None,
        description="TemplateRef is the reference to the template resource to execute.",
    )
    when: Optional[str] = Field(
        None,
        description="When is an expression in which the task should conditionally execute",
    )
    withItems: Optional[List[Item]] = Field(
        None,
        description="WithItems expands a task into multiple parallel tasks from the items in the list",
    )
    withParam: Optional[str] = Field(
        None,
        description="WithParam expands a task into multiple parallel tasks from the value in the parameter, which is expected to be a JSON list.",
    )
    withSequence: Optional[Sequence] = Field(
        None, description="WithSequence expands a task into a numeric sequence"
    )


class DAGTemplate(BaseModel):
    failFast: Optional[bool] = Field(
        None,
        description='This flag is for DAG logic. The DAG logic has a built-in "fail fast" feature to stop scheduling new steps, as soon as it detects that one of the DAG nodes is failed. Then it waits until all DAG nodes are completed before failing the DAG itself. The FailFast flag default is true,  if set to false, it will allow a DAG to run all branches of the DAG to completion (either success or failure), regardless of the failed outcomes of branches in the DAG. More info and example about this feature at https://github.com/argoproj/argo_workflows/issues/1442',
    )
    target: Optional[str] = Field(
        None, description="Target are one or more names of targets to execute in a DAG"
    )
    tasks: List[DAGTask] = Field(..., description="Tasks are a list of DAG tasks")


class NodeStatus(BaseModel):
    boundaryID: Optional[str] = Field(
        None,
        description="BoundaryID indicates the node ID of the associated template root node in which this node belongs to",
    )
    children: Optional[List[str]] = Field(
        None, description="Children is a list of child node IDs"
    )
    daemoned: Optional[bool] = Field(
        None,
        description="Daemoned tracks whether or not this node was daemoned and need to be terminated",
    )
    displayName: Optional[str] = Field(
        None,
        description="DisplayName is a human readable representation of the node. Unique within a template boundary",
    )
    estimatedDuration: Optional[int] = Field(
        None, description="EstimatedDuration in seconds."
    )
    finishedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this node completed"
    )
    hostNodeName: Optional[str] = Field(
        None,
        description="HostNodeName name of the Kubernetes node on which the Pod is running, if applicable",
    )
    id: str = Field(
        ...,
        description="ID is a unique identifier of a node within the worklow It is implemented as a hash of the node name, which makes the ID deterministic",
    )
    inputs: Optional[Inputs] = Field(
        None,
        description="Inputs captures input parameter values and artifact locations supplied to this template invocation",
    )
    memoizationStatus: Optional[MemoizationStatus] = Field(
        None, description="MemoizationStatus holds information about cached nodes"
    )
    message: Optional[str] = Field(
        None,
        description="A human readable message indicating details about why the node is in this condition.",
    )
    name: str = Field(
        ...,
        description="Name is unique name in the node tree used to generate the node ID",
    )
    outboundNodes: Optional[List[str]] = Field(
        None,
        description='OutboundNodes tracks the node IDs which are considered "outbound" nodes to a template invocation. For every invocation of a template, there are nodes which we considered as "outbound". Essentially, these are last nodes in the execution sequence to run, before the template is considered completed. These nodes are then connected as parents to a following step.\n\nIn the case of single pod steps (i.e. container, script, resource templates), this list will be nil since the pod itself is already considered the "outbound" node. In the case of DAGs, outbound nodes are the "target" tasks (tasks with no children). In the case of steps, outbound nodes are all the containers involved in the last step group. NOTE: since templates are composable, the list of outbound nodes are carried upwards when a DAG/steps template invokes another DAG/steps template. In other words, the outbound nodes of a template, will be a superset of the outbound nodes of its last children.',
    )
    outputs: Optional[Outputs] = Field(
        None,
        description="Outputs captures output parameter values and artifact locations produced by this template invocation",
    )
    phase: Optional[str] = Field(
        None,
        description="Phase a simple, high-level summary of where the node is in its lifecycle. Can be used as a state machine.",
    )
    podIP: Optional[str] = Field(
        None, description="PodIP captures the IP of the pod for daemoned steps"
    )
    progress: Optional[str] = Field(None, description="Progress to completion")
    resourcesDuration: Optional[Dict[str, int]] = Field(
        None,
        description="ResourcesDuration is indicative, but not accurate, resource duration. This is populated when the nodes completes.",
    )
    startedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this node started"
    )
    synchronizationStatus: Optional[NodeSynchronizationStatus] = Field(
        None,
        description="SynchronizationStatus is the synchronization status of the node",
    )
    templateName: Optional[str] = Field(
        None,
        description="TemplateName is the template name which this node corresponds to. Not applicable to virtual nodes (e.g. Retry, StepGroup)",
    )
    templateRef: Optional[TemplateRef] = Field(
        None,
        description="TemplateRef is the reference to the template resource which this node corresponds to. Not applicable to virtual nodes (e.g. Retry, StepGroup)",
    )
    templateScope: Optional[str] = Field(
        None,
        description="TemplateScope is the template scope in which the template of this node was retrieved.",
    )
    type: str = Field(..., description="Type indicates type of node")


class Submit(BaseModel):
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments extracted from the event and then set as arguments to the workflow created.",
    )
    metadata: Optional[v1_1.ObjectMeta] = Field(
        None,
        description="Metadata optional means to customize select fields of the workflow metadata",
    )
    workflowTemplateRef: WorkflowTemplateRef = Field(
        ..., description="WorkflowTemplateRef the workflow template to submit"
    )


class WorkflowEventBindingSpec(BaseModel):
    event: Event = Field(..., description="Event is the event to bind to")
    submit: Optional[Submit] = Field(
        None, description="Submit is the workflow template to submit"
    )


class WorkflowStep(BaseModel):
    arguments: Optional[Arguments] = Field(
        None, description="Arguments hold arguments to the template"
    )
    continueOn: Optional[ContinueOn] = Field(
        None,
        description="ContinueOn makes argo to proceed with the following step even if this step fails. Errors and Failed states can be specified",
    )
    name: Optional[str] = Field(None, description="Name of the step")
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the template, irrespective of the success, failure, or error of the primary template.",
    )
    template: Optional[str] = Field(
        None, description="Template is the name of the template to execute as the step"
    )
    templateRef: Optional[TemplateRef] = Field(
        None,
        description="TemplateRef is the reference to the template resource to execute as the step.",
    )
    when: Optional[str] = Field(
        None,
        description="When is an expression in which the step should conditionally execute",
    )
    withItems: Optional[List[Item]] = Field(
        None,
        description="WithItems expands a step into multiple parallel steps from the items in the list",
    )
    withParam: Optional[str] = Field(
        None,
        description="WithParam expands a step into multiple parallel steps from the value in the parameter, which is expected to be a JSON list.",
    )
    withSequence: Optional[Sequence] = Field(
        None, description="WithSequence expands a step into a numeric sequence"
    )


class ParallelSteps(BaseModel):
    __root__: List[WorkflowStep]


class ScriptTemplate(BaseModel):
    args: Optional[List[str]] = Field(
        None,
        description="Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    command: Optional[List[str]] = Field(
        None,
        description="Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    env: Optional[List[v1.EnvVar]] = Field(
        None,
        description="List of environment variables to set in the container. Cannot be updated.",
    )
    envFrom: Optional[List[v1.EnvFromSource]] = Field(
        None,
        description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
    )
    image: str = Field(
        ...,
        description="Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.",
    )
    imagePullPolicy: Optional[str] = Field(
        None,
        description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images",
    )
    lifecycle: Optional[v1.Lifecycle] = Field(
        None,
        description="Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
    )
    livenessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    name: Optional[str] = Field(
        None,
        description="Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.",
    )
    ports: Optional[List[v1.ContainerPort]] = Field(
        None,
        description='List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Cannot be updated.',
    )
    readinessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    resources: Optional[v1.ResourceRequirements] = Field(
        None,
        description="Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
    )
    securityContext: Optional[v1.SecurityContext] = Field(
        None,
        description="Security options the pod should run with. More info: https://kubernetes.io/docs/concepts/policy/security-context/ More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/",
    )
    source: str = Field(
        ..., description="Source contains the source code of the script to execute"
    )
    startupProbe: Optional[v1.Probe] = Field(
        None,
        description="StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. This is a beta feature enabled by the StartupProbe feature flag. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    stdin: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.",
    )
    stdinOnce: Optional[bool] = Field(
        None,
        description="Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false",
    )
    terminationMessagePath: Optional[str] = Field(
        None,
        description="Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.",
    )
    terminationMessagePolicy: Optional[str] = Field(
        None,
        description="Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.",
    )
    tty: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.",
    )
    volumeDevices: Optional[List[v1.VolumeDevice]] = Field(
        None,
        description="volumeDevices is the list of block devices to be used by the container.",
    )
    volumeMounts: Optional[List[v1.VolumeMount]] = Field(
        None,
        description="Pod volumes to mount into the container's filesystem. Cannot be updated.",
    )
    workingDir: Optional[str] = Field(
        None,
        description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
    )


class UserContainer(BaseModel):
    args: Optional[List[str]] = Field(
        None,
        description="Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    command: Optional[List[str]] = Field(
        None,
        description="Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    env: Optional[List[v1.EnvVar]] = Field(
        None,
        description="List of environment variables to set in the container. Cannot be updated.",
    )
    envFrom: Optional[List[v1.EnvFromSource]] = Field(
        None,
        description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
    )
    image: Optional[str] = Field(
        None,
        description="Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.",
    )
    imagePullPolicy: Optional[str] = Field(
        None,
        description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images",
    )
    lifecycle: Optional[v1.Lifecycle] = Field(
        None,
        description="Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
    )
    livenessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    mirrorVolumeMounts: Optional[bool] = Field(
        None,
        description="MirrorVolumeMounts will mount the same volumes specified in the main container to the container (including artifacts), at the same mountPaths. This enables dind daemon to partially see the same filesystem as the main container in order to use features such as docker volume binding",
    )
    name: str = Field(
        ...,
        description="Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.",
    )
    ports: Optional[List[v1.ContainerPort]] = Field(
        None,
        description='List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Cannot be updated.',
    )
    readinessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    resources: Optional[v1.ResourceRequirements] = Field(
        None,
        description="Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
    )
    securityContext: Optional[v1.SecurityContext] = Field(
        None,
        description="Security options the pod should run with. More info: https://kubernetes.io/docs/concepts/policy/security-context/ More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/",
    )
    startupProbe: Optional[v1.Probe] = Field(
        None,
        description="StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. This is a beta feature enabled by the StartupProbe feature flag. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    stdin: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.",
    )
    stdinOnce: Optional[bool] = Field(
        None,
        description="Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false",
    )
    terminationMessagePath: Optional[str] = Field(
        None,
        description="Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.",
    )
    terminationMessagePolicy: Optional[str] = Field(
        None,
        description="Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.",
    )
    tty: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.",
    )
    volumeDevices: Optional[List[v1.VolumeDevice]] = Field(
        None,
        description="volumeDevices is the list of block devices to be used by the container.",
    )
    volumeMounts: Optional[List[v1.VolumeMount]] = Field(
        None,
        description="Pod volumes to mount into the container's filesystem. Cannot be updated.",
    )
    workingDir: Optional[str] = Field(
        None,
        description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
    )


class WorkflowEventBinding(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowEventBindingSpec


class WorkflowEventBindingList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[WorkflowEventBinding]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class Template(BaseModel):
    activeDeadlineSeconds: Optional[intstr.IntOrString] = Field(
        None,
        description="Optional duration in seconds relative to the StartTime that the pod may be active on a node before the system actively tries to terminate the pod; value must be positive integer This field is only applicable to container and script templates.",
    )
    affinity: Optional[v1.Affinity] = Field(
        None,
        description="Affinity sets the pod's scheduling constraints Overrides the affinity set at the workflow level (if any)",
    )
    archiveLocation: Optional[ArtifactLocation] = Field(
        None,
        description="Location in which all files related to the step will be stored (logs, artifacts, etc...). Can be overridden by individual items in Outputs. If omitted, will use the default artifact repository location configured in the controller, appended with the <workflowname>/<nodename> in the key.",
    )
    automountServiceAccountToken: Optional[bool] = Field(
        None,
        description="AutomountServiceAccountToken indicates whether a service account token should be automatically mounted in pods. ServiceAccountName of ExecutorConfig must be specified if this value is false.",
    )
    container: Optional[v1.Container] = Field(
        None, description="Container is the main container image to run in the pod"
    )
    daemon: Optional[bool] = Field(
        None,
        description="Deamon will allow a workflow to proceed to the next step so long as the container reaches readiness",
    )
    dag: Optional[DAGTemplate] = Field(
        None, description="DAG template subtype which runs a DAG"
    )
    executor: Optional[ExecutorConfig] = Field(
        None, description="Executor holds configurations of the executor container."
    )
    hostAliases: Optional[List[v1.HostAlias]] = Field(
        None,
        description="HostAliases is an optional list of hosts and IPs that will be injected into the pod spec",
    )
    initContainers: Optional[List[UserContainer]] = Field(
        None,
        description="InitContainers is a list of containers which run before the main container.",
    )
    inputs: Optional[Inputs] = Field(
        None,
        description="Inputs describe what inputs parameters and artifacts are supplied to this template",
    )
    memoize: Optional[Memoize] = Field(
        None,
        description="Memoize allows templates to use outputs generated from already executed templates",
    )
    metadata: Optional[Metadata] = Field(
        None,
        description="Metdata sets the pods's metadata, i.e. annotations and labels",
    )
    metrics: Optional[Metrics] = Field(
        None, description="Metrics are a list of metrics emitted from this template"
    )
    name: str = Field(..., description="Name is the name of the template")
    nodeSelector: Optional[Dict[str, str]] = Field(
        None,
        description="NodeSelector is a selector to schedule this step of the workflow to be run on the selected node(s). Overrides the selector set at the workflow level.",
    )
    outputs: Optional[Outputs] = Field(
        None,
        description="Outputs describe the parameters and artifacts that this template produces",
    )
    parallelism: Optional[int] = Field(
        None,
        description="Parallelism limits the max total parallel pods that can execute at the same time within the boundaries of this template invocation. If additional steps/dag templates are invoked, the pods created by those templates will not be counted towards this total.",
    )
    podSpecPatch: Optional[str] = Field(
        None,
        description="PodSpecPatch holds strategic merge patch to apply against the pod spec. Allows parameterization of container fields which are not strings (e.g. resource limits).",
    )
    priority: Optional[int] = Field(
        None, description="Priority to apply to workflow pods."
    )
    priorityClassName: Optional[str] = Field(
        None, description="PriorityClassName to apply to workflow pods."
    )
    resource: Optional[ResourceTemplate] = Field(
        None, description="Resource template subtype which can run k8s resources"
    )
    retryStrategy: Optional[RetryStrategy] = Field(
        None,
        description="RetryStrategy describes how to retry a template when it fails",
    )
    schedulerName: Optional[str] = Field(
        None,
        description="If specified, the pod will be dispatched by specified scheduler. Or it will be dispatched by workflow scope scheduler if specified. If neither specified, the pod will be dispatched by default scheduler.",
    )
    script: Optional[ScriptTemplate] = Field(
        None, description="Script runs a portion of code against an interpreter"
    )
    securityContext: Optional[v1.PodSecurityContext] = Field(
        None,
        description="SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty.  See type description for default values of each field.",
    )
    serviceAccountName: Optional[str] = Field(
        None, description="ServiceAccountName to apply to workflow pods"
    )
    sidecars: Optional[List[UserContainer]] = Field(
        None,
        description="Sidecars is a list of containers which run alongside the main container Sidecars are automatically killed when the main container completes",
    )
    steps: Optional[List[ParallelSteps]] = Field(
        None, description="Steps define a series of sequential/parallel workflow steps"
    )
    suspend: Optional[SuspendTemplate] = Field(
        None,
        description="Suspend template subtype which can suspend a workflow when reaching the step",
    )
    synchronization: Optional[Synchronization] = Field(
        None,
        description="Synchronization holds synchronization lock configuration for this template",
    )
    timeout: Optional[str] = Field(
        None,
        description="Timout allows to set the total node execution timeout duration counting from the node's start time. This duration also includes time in which the node spends in Pending state. This duration may not be applied to Step or DAG templates.",
    )
    tolerations: Optional[List[v1.Toleration]] = Field(
        None, description="Tolerations to apply to workflow pods."
    )
    volumes: Optional[List[v1.Volume]] = Field(
        None,
        description="Volumes is a list of volumes that can be mounted by containers in a template.",
    )


class WorkflowSpec(BaseModel):
    activeDeadlineSeconds: Optional[int] = Field(
        None,
        description="Optional duration in seconds relative to the workflow start time which the workflow is allowed to run before the controller terminates the io.argoproj.workflow.v1alpha1. A value of zero is used to terminate a Running workflow",
    )
    affinity: Optional[v1.Affinity] = Field(
        None,
        description="Affinity sets the scheduling constraints for all pods in the io.argoproj.workflow.v1alpha1. Can be overridden by an affinity specified in the template",
    )
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments contain the parameters and artifacts sent to the workflow entrypoint Parameters are referencable globally using the 'workflow' variable prefix. e.g. {{io.argoproj.workflow.v1alpha1.parameters.myparam}}",
    )
    artifactRepositoryRef: Optional[ArtifactRepositoryRef] = Field(
        None,
        description="ArtifactRepositoryRef specifies the configMap name and key containing the artifact repository config.",
    )
    automountServiceAccountToken: Optional[bool] = Field(
        None,
        description="AutomountServiceAccountToken indicates whether a service account token should be automatically mounted in pods. ServiceAccountName of ExecutorConfig must be specified if this value is false.",
    )
    dnsConfig: Optional[v1.PodDNSConfig] = Field(
        None,
        description="PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.",
    )
    dnsPolicy: Optional[str] = Field(
        None,
        description="Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.",
    )
    entrypoint: Optional[str] = Field(
        None,
        description="Entrypoint is a template reference to the starting point of the io.argoproj.workflow.v1alpha1.",
    )
    executor: Optional[ExecutorConfig] = Field(
        None,
        description="Executor holds configurations of executor containers of the io.argoproj.workflow.v1alpha1.",
    )
    hostAliases: Optional[List[v1.HostAlias]] = None
    hostNetwork: Optional[bool] = Field(
        None,
        description="Host networking requested for this workflow pod. Default to false.",
    )
    imagePullSecrets: Optional[List[v1.LocalObjectReference]] = Field(
        None,
        description="ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod",
    )
    metrics: Optional[Metrics] = Field(
        None, description="Metrics are a list of metrics emitted from this Workflow"
    )
    nodeSelector: Optional[Dict[str, str]] = Field(
        None,
        description="NodeSelector is a selector which will result in all pods of the workflow to be scheduled on the selected node(s). This is able to be overridden by a nodeSelector specified in the template.",
    )
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the workflow, irrespective of the success, failure, or error of the primary io.argoproj.workflow.v1alpha1.",
    )
    parallelism: Optional[int] = Field(
        None,
        description="Parallelism limits the max total parallel pods that can execute at the same time in a workflow",
    )
    podDisruptionBudget: Optional[v1beta1.PodDisruptionBudgetSpec] = Field(
        None,
        description="PodDisruptionBudget holds the number of concurrent disruptions that you allow for Workflow's Pods. Controller will automatically add the selector with workflow name, if selector is empty. Optional: Defaults to empty.",
    )
    podGC: Optional[PodGC] = Field(
        None,
        description="PodGC describes the strategy to use when to deleting completed pods",
    )
    podMetadata: Optional[Metadata] = Field(
        None,
        description="PodMetadata defines additional metadata that should be applied to workflow pods",
    )
    podPriority: Optional[int] = Field(
        None, description="Priority to apply to workflow pods."
    )
    podPriorityClassName: Optional[str] = Field(
        None, description="PriorityClassName to apply to workflow pods."
    )
    podSpecPatch: Optional[str] = Field(
        None,
        description="PodSpecPatch holds strategic merge patch to apply against the pod spec. Allows parameterization of container fields which are not strings (e.g. resource limits).",
    )
    priority: Optional[int] = Field(
        None,
        description="Priority is used if controller is configured to process limited number of workflows in parallel. Workflows with higher priority are processed first.",
    )
    retryStrategy: Optional[RetryStrategy] = Field(
        None,
        description="RetryStrategy for all templates in the io.argoproj.workflow.v1alpha1.",
    )
    schedulerName: Optional[str] = Field(
        None,
        description="Set scheduler name for all pods. Will be overridden if container/script template's scheduler name is set. Default scheduler will be used if neither specified.",
    )
    securityContext: Optional[v1.PodSecurityContext] = Field(
        None,
        description="SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty.  See type description for default values of each field.",
    )
    serviceAccountName: Optional[str] = Field(
        None,
        description="ServiceAccountName is the name of the ServiceAccount to run all pods of the workflow as.",
    )
    shutdown: Optional[str] = Field(
        None,
        description="Shutdown will shutdown the workflow according to its ShutdownStrategy",
    )
    suspend: Optional[bool] = Field(
        None,
        description="Suspend will suspend the workflow and prevent execution of any future steps in the workflow",
    )
    synchronization: Optional[Synchronization] = Field(
        None,
        description="Synchronization holds synchronization lock configuration for this Workflow",
    )
    templates: Optional[List[Template]] = Field(
        None, description="Templates is a list of workflow templates used in a workflow"
    )
    tolerations: Optional[List[v1.Toleration]] = Field(
        None, description="Tolerations to apply to workflow pods."
    )
    ttlStrategy: Optional[TTLStrategy] = Field(
        None,
        description="TTLStrategy limits the lifetime of a Workflow that has finished execution depending on if it Succeeded or Failed. If this struct is set, once the Workflow finishes, it will be deleted after the time to live expires. If this field is unset, the controller config map will hold the default values.",
    )
    volumeClaimGC: Optional[VolumeClaimGC] = Field(
        None,
        description="VolumeClaimGC describes the strategy to use when to deleting volumes from completed workflows",
    )
    volumeClaimTemplates: Optional[List[v1.PersistentVolumeClaim]] = Field(
        None,
        description="VolumeClaimTemplates is a list of claims that containers are allowed to reference. The Workflow controller will create the claims at the beginning of the workflow and delete the claims upon completion of the workflow",
    )
    volumes: Optional[List[v1.Volume]] = Field(
        None,
        description="Volumes is a list of volumes that can be mounted by containers in a io.argoproj.workflow.v1alpha1.",
    )
    workflowTemplateRef: Optional[WorkflowTemplateRef] = Field(
        None,
        description="WorkflowTemplateRef holds a reference to a WorkflowTemplate for execution",
    )


class WorkflowStatus(BaseModel):
    artifactRepositoryRef: Optional[ArtifactRepositoryRefStatus] = Field(
        None,
        description="ArtifactRepositoryRef is used to cache the repository to use so we do not need to determine it everytime we reconcile.",
    )
    compressedNodes: Optional[str] = Field(
        None, description="Compressed and base64 decoded Nodes map"
    )
    conditions: Optional[List[Condition]] = Field(
        None, description="Conditions is a list of conditions the Workflow may have"
    )
    estimatedDuration: Optional[int] = Field(
        None, description="EstimatedDuration in seconds."
    )
    finishedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this workflow completed"
    )
    message: Optional[str] = Field(
        None,
        description="A human readable message indicating details about why the workflow is in this condition.",
    )
    nodes: Optional[Dict[str, NodeStatus]] = Field(
        None, description="Nodes is a mapping between a node ID and the node's status."
    )
    offloadNodeStatusVersion: Optional[str] = Field(
        None,
        description="Whether on not node status has been offloaded to a database. If exists, then Nodes and CompressedNodes will be empty. This will actually be populated with a hash of the offloaded data.",
    )
    outputs: Optional[Outputs] = Field(
        None,
        description="Outputs captures output values and artifact locations produced by the workflow via global outputs",
    )
    persistentVolumeClaims: Optional[List[v1.Volume]] = Field(
        None,
        description="PersistentVolumeClaims tracks all PVCs that were created as part of the io.argoproj.workflow.v1alpha1. The contents of this list are drained at the end of the workflow.",
    )
    phase: Optional[str] = Field(
        None,
        description="Phase a simple, high-level summary of where the workflow is in its lifecycle.",
    )
    progress: Optional[str] = Field(None, description="Progress to completion")
    resourcesDuration: Optional[Dict[str, int]] = Field(
        None, description="ResourcesDuration is the total for the workflow"
    )
    startedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this workflow started"
    )
    storedTemplates: Optional[Dict[str, Template]] = Field(
        None,
        description="StoredTemplates is a mapping between a template ref and the node's status.",
    )
    storedWorkflowTemplateSpec: Optional[WorkflowSpec] = Field(
        None,
        description="StoredWorkflowSpec stores the WorkflowTemplate spec for future execution.",
    )
    synchronization: Optional[SynchronizationStatus] = Field(
        None, description="Synchronization stores the status of synchronization locks"
    )


class WorkflowTemplateSpec(BaseModel):
    activeDeadlineSeconds: Optional[int] = Field(
        None,
        description="Optional duration in seconds relative to the workflow start time which the workflow is allowed to run before the controller terminates the io.argoproj.workflow.v1alpha1. A value of zero is used to terminate a Running workflow",
    )
    affinity: Optional[v1.Affinity] = Field(
        None,
        description="Affinity sets the scheduling constraints for all pods in the io.argoproj.workflow.v1alpha1. Can be overridden by an affinity specified in the template",
    )
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments contain the parameters and artifacts sent to the workflow entrypoint Parameters are referencable globally using the 'workflow' variable prefix. e.g. {{io.argoproj.workflow.v1alpha1.parameters.myparam}}",
    )
    artifactRepositoryRef: Optional[ArtifactRepositoryRef] = Field(
        None,
        description="ArtifactRepositoryRef specifies the configMap name and key containing the artifact repository config.",
    )
    automountServiceAccountToken: Optional[bool] = Field(
        None,
        description="AutomountServiceAccountToken indicates whether a service account token should be automatically mounted in pods. ServiceAccountName of ExecutorConfig must be specified if this value is false.",
    )
    dnsConfig: Optional[v1.PodDNSConfig] = Field(
        None,
        description="PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.",
    )
    dnsPolicy: Optional[str] = Field(
        None,
        description="Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.",
    )
    entrypoint: Optional[str] = Field(
        None,
        description="Entrypoint is a template reference to the starting point of the io.argoproj.workflow.v1alpha1.",
    )
    executor: Optional[ExecutorConfig] = Field(
        None,
        description="Executor holds configurations of executor containers of the io.argoproj.workflow.v1alpha1.",
    )
    hostAliases: Optional[List[v1.HostAlias]] = None
    hostNetwork: Optional[bool] = Field(
        None,
        description="Host networking requested for this workflow pod. Default to false.",
    )
    imagePullSecrets: Optional[List[v1.LocalObjectReference]] = Field(
        None,
        description="ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod",
    )
    metrics: Optional[Metrics] = Field(
        None, description="Metrics are a list of metrics emitted from this Workflow"
    )
    nodeSelector: Optional[Dict[str, str]] = Field(
        None,
        description="NodeSelector is a selector which will result in all pods of the workflow to be scheduled on the selected node(s). This is able to be overridden by a nodeSelector specified in the template.",
    )
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the workflow, irrespective of the success, failure, or error of the primary io.argoproj.workflow.v1alpha1.",
    )
    parallelism: Optional[int] = Field(
        None,
        description="Parallelism limits the max total parallel pods that can execute at the same time in a workflow",
    )
    podDisruptionBudget: Optional[v1beta1.PodDisruptionBudgetSpec] = Field(
        None,
        description="PodDisruptionBudget holds the number of concurrent disruptions that you allow for Workflow's Pods. Controller will automatically add the selector with workflow name, if selector is empty. Optional: Defaults to empty.",
    )
    podGC: Optional[PodGC] = Field(
        None,
        description="PodGC describes the strategy to use when to deleting completed pods",
    )
    podMetadata: Optional[Metadata] = Field(
        None,
        description="PodMetadata defines additional metadata that should be applied to workflow pods",
    )
    podPriority: Optional[int] = Field(
        None, description="Priority to apply to workflow pods."
    )
    podPriorityClassName: Optional[str] = Field(
        None, description="PriorityClassName to apply to workflow pods."
    )
    podSpecPatch: Optional[str] = Field(
        None,
        description="PodSpecPatch holds strategic merge patch to apply against the pod spec. Allows parameterization of container fields which are not strings (e.g. resource limits).",
    )
    priority: Optional[int] = Field(
        None,
        description="Priority is used if controller is configured to process limited number of workflows in parallel. Workflows with higher priority are processed first.",
    )
    retryStrategy: Optional[RetryStrategy] = Field(
        None,
        description="RetryStrategy for all templates in the io.argoproj.workflow.v1alpha1.",
    )
    schedulerName: Optional[str] = Field(
        None,
        description="Set scheduler name for all pods. Will be overridden if container/script template's scheduler name is set. Default scheduler will be used if neither specified.",
    )
    securityContext: Optional[v1.PodSecurityContext] = Field(
        None,
        description="SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty.  See type description for default values of each field.",
    )
    serviceAccountName: Optional[str] = Field(
        None,
        description="ServiceAccountName is the name of the ServiceAccount to run all pods of the workflow as.",
    )
    shutdown: Optional[str] = Field(
        None,
        description="Shutdown will shutdown the workflow according to its ShutdownStrategy",
    )
    suspend: Optional[bool] = Field(
        None,
        description="Suspend will suspend the workflow and prevent execution of any future steps in the workflow",
    )
    synchronization: Optional[Synchronization] = Field(
        None,
        description="Synchronization holds synchronization lock configuration for this Workflow",
    )
    templates: Optional[List[Template]] = Field(
        None, description="Templates is a list of workflow templates used in a workflow"
    )
    tolerations: Optional[List[v1.Toleration]] = Field(
        None, description="Tolerations to apply to workflow pods."
    )
    ttlStrategy: Optional[TTLStrategy] = Field(
        None,
        description="TTLStrategy limits the lifetime of a Workflow that has finished execution depending on if it Succeeded or Failed. If this struct is set, once the Workflow finishes, it will be deleted after the time to live expires. If this field is unset, the controller config map will hold the default values.",
    )
    volumeClaimGC: Optional[VolumeClaimGC] = Field(
        None,
        description="VolumeClaimGC describes the strategy to use when to deleting volumes from completed workflows",
    )
    volumeClaimTemplates: Optional[List[v1.PersistentVolumeClaim]] = Field(
        None,
        description="VolumeClaimTemplates is a list of claims that containers are allowed to reference. The Workflow controller will create the claims at the beginning of the workflow and delete the claims upon completion of the workflow",
    )
    volumes: Optional[List[v1.Volume]] = Field(
        None,
        description="Volumes is a list of volumes that can be mounted by containers in a io.argoproj.workflow.v1alpha1.",
    )
    workflowMetadata: Optional[v1_1.ObjectMeta] = Field(
        None,
        description="WorkflowMetadata contains some metadata of the workflow to be refer",
    )
    workflowTemplateRef: Optional[WorkflowTemplateRef] = Field(
        None,
        description="WorkflowTemplateRef holds a reference to a WorkflowTemplate for execution",
    )


class ClusterWorkflowTemplate(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowTemplateSpec


class ClusterWorkflowTemplateCreateRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    template: Optional[ClusterWorkflowTemplate] = None


class ClusterWorkflowTemplateLintRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    template: Optional[ClusterWorkflowTemplate] = None


class ClusterWorkflowTemplateList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[ClusterWorkflowTemplate]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class ClusterWorkflowTemplateUpdateRequest(BaseModel):
    name: Optional[str] = Field(None, description="DEPRECATED: This field is ignored.")
    template: Optional[ClusterWorkflowTemplate] = None


class CronWorkflowSpec(BaseModel):
    concurrencyPolicy: Optional[str] = Field(
        None,
        description="ConcurrencyPolicy is the K8s-style concurrency policy that will be used",
    )
    failedJobsHistoryLimit: Optional[int] = Field(
        None,
        description="FailedJobsHistoryLimit is the number of failed jobs to be kept at a time",
    )
    schedule: str = Field(
        ..., description="Schedule is a schedule to run the Workflow in Cron format"
    )
    startingDeadlineSeconds: Optional[int] = Field(
        None,
        description="StartingDeadlineSeconds is the K8s-style deadline that will limit the time a CronWorkflow will be run after its original scheduled time if it is missed.",
    )
    successfulJobsHistoryLimit: Optional[int] = Field(
        None,
        description="SuccessfulJobsHistoryLimit is the number of successful jobs to be kept at a time",
    )
    suspend: Optional[bool] = Field(
        None,
        description="Suspend is a flag that will stop new CronWorkflows from running if set to true",
    )
    timezone: Optional[str] = Field(
        None,
        description='Timezone is the timezone against which the cron schedule will be calculated, e.g. "Asia/Tokyo". Default is machine\'s local time.',
    )
    workflowMetadata: Optional[v1_1.ObjectMeta] = Field(
        None,
        description="WorkflowMetadata contains some metadata of the workflow to be run",
    )
    workflowSpec: WorkflowSpec = Field(
        ..., description="WorkflowSpec is the spec of the workflow to be run"
    )


class Workflow(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowSpec
    status: Optional[WorkflowStatus] = None


class WorkflowCreateRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    instanceID: Optional[str] = Field(None, description="This field is no longer used.")
    namespace: Optional[str] = None
    serverDryRun: Optional[bool] = None
    workflow: Optional[Workflow] = None


class WorkflowLintRequest(BaseModel):
    namespace: Optional[str] = None
    workflow: Optional[Workflow] = None


class WorkflowList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[Workflow]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class WorkflowTemplate(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowTemplateSpec


class WorkflowTemplateCreateRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    namespace: Optional[str] = None
    template: Optional[WorkflowTemplate] = None


class WorkflowTemplateLintRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    namespace: Optional[str] = None
    template: Optional[WorkflowTemplate] = None


class WorkflowTemplateList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[WorkflowTemplate]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class WorkflowTemplateUpdateRequest(BaseModel):
    name: Optional[str] = Field(None, description="DEPRECATED: This field is ignored.")
    namespace: Optional[str] = None
    template: Optional[WorkflowTemplate] = None


class WorkflowWatchEvent(BaseModel):
    object: Optional[Workflow] = Field(None, title="the workflow")
    type: Optional[str] = Field(None, title="the type of change")


class CronWorkflow(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: CronWorkflowSpec
    status: Optional[CronWorkflowStatus] = None


class CronWorkflowList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[CronWorkflow]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class LintCronWorkflowRequest(BaseModel):
    cronWorkflow: Optional[CronWorkflow] = None
    namespace: Optional[str] = None


class UpdateCronWorkflowRequest(BaseModel):
    cronWorkflow: Optional[CronWorkflow] = None
    name: Optional[str] = Field(None, description="DEPRECATED: This field is ignored.")
    namespace: Optional[str] = None


class CreateCronWorkflowRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    cronWorkflow: Optional[CronWorkflow] = None
    namespace: Optional[str] = None

<filename>argo_dsl/api/io/argoproj/workflow/v1alpha1.py
# generated by datamodel-codegen:
#   filename:  https://raw.githubusercontent.com/argoproj/argo-workflows/stable/api/openapi-spec/swagger.json

from __future__ import annotations

from typing import Any
from typing import Dict
from typing import List
from typing import Optional

from pydantic import BaseModel
from pydantic import Field

from ...k8s.api.core import v1
from ...k8s.api.policy import v1beta1
from ...k8s.apimachinery.pkg.apis.meta import v1 as v1_1
from ...k8s.apimachinery.pkg.util import intstr


class Amount(BaseModel):
    __root__: float = Field(..., description="Amount represent a numeric amount.")


class ArchivedWorkflowDeletedResponse(BaseModel):
    pass


class ArtifactRepositoryRef(BaseModel):
    configMap: Optional[str] = Field(
        None,
        description='The name of the config map. Defaults to "artifact-repositories".',
    )
    key: Optional[str] = Field(
        None,
        description='The config map key. Defaults to the value of the "workflows.argoproj.io/default-artifact-repository" annotation.',
    )


class ArtifactRepositoryRefStatus(BaseModel):
    configMap: Optional[str] = Field(
        None,
        description='The name of the config map. Defaults to "artifact-repositories".',
    )
    default: Optional[bool] = Field(
        None,
        description="If this ref represents the default artifact repository, rather than a config map.",
    )
    key: Optional[str] = Field(
        None,
        description='The config map key. Defaults to the value of the "workflows.argoproj.io/default-artifact-repository" annotation.',
    )
    namespace: Optional[str] = Field(
        None,
        description="The namespace of the config map. Defaults to the workflow's namespace, or the controller's namespace (if found).",
    )


class ClusterWorkflowTemplateDeleteResponse(BaseModel):
    pass


class Condition(BaseModel):
    message: Optional[str] = Field(None, description="Message is the condition message")
    status: Optional[str] = Field(
        None, description="Status is the status of the condition"
    )
    type: Optional[str] = Field(None, description="Type is the type of condition")


class ContinueOn(BaseModel):
    error: Optional[bool] = None
    failed: Optional[bool] = None


class Counter(BaseModel):
    value: str = Field(..., description="Value is the value of the metric")


class CreateS3BucketOptions(BaseModel):
    objectLocking: Optional[bool] = Field(
        None, description="ObjectLocking Enable object locking"
    )


class CronWorkflowDeletedResponse(BaseModel):
    pass


class CronWorkflowResumeRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class CronWorkflowSuspendRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class Event(BaseModel):
    selector: str = Field(
        ...,
        description='Selector (https://github.com/antonmedv/expr) that we must must match the io.argoproj.workflow.v1alpha1. E.g. `payload.message == "test"`',
    )


class EventResponse(BaseModel):
    pass


class ExecutorConfig(BaseModel):
    serviceAccountName: Optional[str] = Field(
        None,
        description="ServiceAccountName specifies the service account name of the executor container.",
    )


class Gauge(BaseModel):
    realtime: bool = Field(
        ..., description="Realtime emits this metric in real time if applicable"
    )
    value: str = Field(..., description="Value is the value of the metric")


class GetUserInfoResponse(BaseModel):
    email: Optional[str] = None
    emailVerified: Optional[bool] = None
    groups: Optional[List[str]] = None
    issuer: Optional[str] = None
    serviceAccountName: Optional[str] = None
    subject: Optional[str] = None


class Header(BaseModel):
    name: str = Field(..., description="Name is the header name")
    value: str = Field(
        ..., description="Value is the literal value to use for the header"
    )


class Histogram(BaseModel):
    buckets: List[Amount] = Field(
        ..., description="Buckets is a list of bucket divisors for the histogram"
    )
    value: str = Field(..., description="Value is the value of the metric")


class Item(BaseModel):
    __root__: Any = Field(
        ...,
        description="Item expands a single workflow step into multiple parallel steps The value of Item can be a map, string, bool, or number",
    )


class Link(BaseModel):
    name: str = Field(
        ..., description='The name of the link, E.g. "Workflow Logs" or "Pod Logs"'
    )
    scope: str = Field(..., description='Either "workflow" or "pod"')
    url: str = Field(
        ...,
        description='The URL. May contain "${metadata.namespace}", "${metadata.name}", "${status.startedAt}" and "${status.finishedAt}".',
    )


class LogEntry(BaseModel):
    content: Optional[str] = None
    podName: Optional[str] = None


class MemoizationStatus(BaseModel):
    cacheName: str = Field(
        ..., description="Cache is the name of the cache that was used"
    )
    hit: bool = Field(
        ...,
        description="Hit indicates whether this node was created from a cache entry",
    )
    key: str = Field(
        ..., description="Key is the name of the key used for this node's cache"
    )


class Metadata(BaseModel):
    annotations: Optional[Dict[str, str]] = None
    labels: Optional[Dict[str, str]] = None


class MetricLabel(BaseModel):
    key: str
    value: str


class Mutex(BaseModel):
    name: Optional[str] = Field(None, description="name of the mutex")


class MutexHolding(BaseModel):
    holder: Optional[str] = Field(
        None,
        description="Holder is a reference to the object which holds the Mutex. Holding Scenario:\n  1. Current workflow's NodeID which is holding the lock.\n     e.g: ${NodeID}\nWaiting Scenario:\n  1. Current workflow or other workflow NodeID which is holding the lock.\n     e.g: ${WorkflowName}/${NodeID}",
    )
    mutex: Optional[str] = Field(
        None, description="Reference for the mutex e.g: ${namespace}/mutex/${mutexName}"
    )


class MutexStatus(BaseModel):
    holding: Optional[List[MutexHolding]] = Field(
        None,
        description="Holding is a list of mutexes and their respective objects that are held by mutex lock for this io.argoproj.workflow.v1alpha1.",
    )
    waiting: Optional[List[MutexHolding]] = Field(
        None,
        description="Waiting is a list of mutexes and their respective objects this workflow is waiting for.",
    )


class NodeSynchronizationStatus(BaseModel):
    waiting: Optional[str] = Field(
        None,
        description="Waiting is the name of the lock that this node is waiting for",
    )


class NoneStrategy(BaseModel):
    pass


class Prometheus(BaseModel):
    counter: Optional[Counter] = Field(None, description="Counter is a counter metric")
    gauge: Optional[Gauge] = Field(None, description="Gauge is a gauge metric")
    help: str = Field(..., description="Help is a string that describes the metric")
    histogram: Optional[Histogram] = Field(
        None, description="Histogram is a histogram metric"
    )
    labels: Optional[List[MetricLabel]] = Field(
        None, description="Labels is a list of metric labels"
    )
    name: str = Field(..., description="Name is the name of the metric")
    when: Optional[str] = Field(
        None,
        description="When is a conditional statement that decides when to emit the metric",
    )


class RawArtifact(BaseModel):
    data: str = Field(..., description="Data is the string contents of the artifact")


class ResourceTemplate(BaseModel):
    action: str = Field(
        ...,
        description="Action is the action to perform to the resource. Must be one of: get, create, apply, delete, replace, patch",
    )
    failureCondition: Optional[str] = Field(
        None,
        description="FailureCondition is a label selector expression which describes the conditions of the k8s resource in which the step was considered failed",
    )
    flags: Optional[List[str]] = Field(
        None,
        description='Flags is a set of additional options passed to kubectl before submitting a resource I.e. to disable resource validation: flags: [\n\t"--validate=false"  # disable resource validation\n]',
    )
    manifest: Optional[str] = Field(
        None, description="Manifest contains the kubernetes manifest"
    )
    mergeStrategy: Optional[str] = Field(
        None,
        description='MergeStrategy is the strategy used to merge a patch. It defaults to "strategic" Must be one of: strategic, merge, json',
    )
    setOwnerReference: Optional[bool] = Field(
        None,
        description="SetOwnerReference sets the reference to the workflow on the OwnerReference of generated resource.",
    )
    successCondition: Optional[str] = Field(
        None,
        description="SuccessCondition is a label selector expression which describes the conditions of the k8s resource in which it is acceptable to proceed to the following step",
    )


class RetryNodeAntiAffinity(BaseModel):
    pass


class SemaphoreHolding(BaseModel):
    holders: Optional[List[str]] = Field(
        None,
        description="Holders stores the list of current holder names in the io.argoproj.workflow.v1alpha1.",
    )
    semaphore: Optional[str] = Field(
        None, description="Semaphore stores the semaphore name."
    )


class SemaphoreStatus(BaseModel):
    holding: Optional[List[SemaphoreHolding]] = Field(
        None,
        description="Holding stores the list of resource acquired synchronization lock for workflows.",
    )
    waiting: Optional[List[SemaphoreHolding]] = Field(
        None,
        description="Waiting indicates the list of current synchronization lock holders.",
    )


class SuppliedValueFrom(BaseModel):
    pass


class SuspendTemplate(BaseModel):
    duration: Optional[str] = Field(
        None,
        description="Duration is the seconds to wait before automatically resuming a template",
    )


class SynchronizationStatus(BaseModel):
    mutex: Optional[MutexStatus] = Field(
        None, description="Mutex stores this workflow's mutex holder details"
    )
    semaphore: Optional[SemaphoreStatus] = Field(
        None, description="Semaphore stores this workflow's Semaphore holder details"
    )


class TTLStrategy(BaseModel):
    secondsAfterCompletion: Optional[int] = Field(
        None,
        description="SecondsAfterCompletion is the number of seconds to live after completion",
    )
    secondsAfterFailure: Optional[int] = Field(
        None,
        description="SecondsAfterFailure is the number of seconds to live after failure",
    )
    secondsAfterSuccess: Optional[int] = Field(
        None,
        description="SecondsAfterSuccess is the number of seconds to live after success",
    )


class TarStrategy(BaseModel):
    compressionLevel: Optional[int] = Field(
        None,
        description="CompressionLevel specifies the gzip compression level to use for the artifact. Defaults to gzip.DefaultCompression.",
    )


class TemplateRef(BaseModel):
    clusterScope: Optional[bool] = Field(
        None,
        description="ClusterScope indicates the referred template is cluster scoped (i.e. a ClusterWorkflowTemplate).",
    )
    name: Optional[str] = Field(
        None, description="Name is the resource name of the template."
    )
    template: Optional[str] = Field(
        None, description="Template is the name of referred template in the resource."
    )


class ValueFrom(BaseModel):
    default: Optional[str] = Field(
        None,
        description="Default specifies a value to be used if retrieving the value from the specified source fails",
    )
    event: Optional[str] = Field(
        None,
        description="Selector (https://github.com/antonmedv/expr) that is evaluated against the event to get the value of the parameter. E.g. `payload.message`",
    )
    jqFilter: Optional[str] = Field(
        None,
        description="JQFilter expression against the resource object in resource templates",
    )
    jsonPath: Optional[str] = Field(
        None,
        description="JSONPath of a resource to retrieve an output parameter value from in resource templates",
    )
    parameter: Optional[str] = Field(
        None,
        description="Parameter reference to a step or dag task in which to retrieve an output parameter value from (e.g. '{{steps.mystep.outputs.myparam}}')",
    )
    path: Optional[str] = Field(
        None,
        description="Path in the container to retrieve an output parameter value from in container templates",
    )
    supplied: Optional[SuppliedValueFrom] = Field(
        None,
        description="Supplied value to be filled in directly, either through the CLI, API, etc.",
    )


class Version(BaseModel):
    buildDate: str
    compiler: str
    gitCommit: str
    gitTag: str
    gitTreeState: str
    goVersion: str
    platform: str
    version: str


class VolumeClaimGC(BaseModel):
    strategy: Optional[str] = Field(
        None,
        description='Strategy is the strategy to use. One of "OnWorkflowCompletion", "OnWorkflowSuccess"',
    )


class WorkflowDeleteResponse(BaseModel):
    pass


class WorkflowResubmitRequest(BaseModel):
    memoized: Optional[bool] = None
    name: Optional[str] = None
    namespace: Optional[str] = None


class WorkflowResumeRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None


class WorkflowRetryRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None
    restartSuccessful: Optional[bool] = None


class WorkflowSetRequest(BaseModel):
    message: Optional[str] = None
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None
    outputParameters: Optional[str] = None
    phase: Optional[str] = None


class WorkflowStopRequest(BaseModel):
    message: Optional[str] = None
    name: Optional[str] = None
    namespace: Optional[str] = None
    nodeFieldSelector: Optional[str] = None


class WorkflowSuspendRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class WorkflowTemplateDeleteResponse(BaseModel):
    pass


class WorkflowTemplateRef(BaseModel):
    clusterScope: Optional[bool] = Field(
        None,
        description="ClusterScope indicates the referred template is cluster scoped (i.e. a ClusterWorkflowTemplate).",
    )
    name: Optional[str] = Field(
        None, description="Name is the resource name of the workflow template."
    )


class WorkflowTerminateRequest(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None


class ZipStrategy(BaseModel):
    pass


class ArchiveStrategy(BaseModel):
    none: Optional[NoneStrategy] = None
    tar: Optional[TarStrategy] = None
    zip: Optional[ZipStrategy] = None


class ArtifactoryArtifact(BaseModel):
    passwordSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="PasswordSecret is the secret selector to the repository password",
    )
    url: str = Field(..., description="URL of the artifact")
    usernameSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="UsernameSecret is the secret selector to the repository username",
    )


class Backoff(BaseModel):
    duration: Optional[str] = Field(
        None,
        description='Duration is the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h")',
    )
    factor: Optional[intstr.IntOrString] = Field(
        None,
        description="Factor is a factor to multiply the base duration after each failed retry",
    )
    maxDuration: Optional[str] = Field(
        None,
        description="MaxDuration is the maximum amount of time allowed for the backoff strategy",
    )


class Cache(BaseModel):
    configMap: v1.ConfigMapKeySelector = Field(
        ..., description="ConfigMap sets a ConfigMap-based cache"
    )


class CronWorkflowStatus(BaseModel):
    active: List[v1.ObjectReference] = Field(
        ...,
        description="Active is a list of active workflows stemming from this CronWorkflow",
    )
    conditions: List[Condition] = Field(
        ..., description="Conditions is a list of conditions the CronWorkflow may have"
    )
    lastScheduledTime: v1_1.Time = Field(
        ...,
        description="LastScheduleTime is the last time the CronWorkflow was scheduled",
    )


class GCSArtifact(BaseModel):
    bucket: Optional[str] = Field(None, description="Bucket is the name of the bucket")
    key: str = Field(
        ..., description="Key is the path in the bucket where the artifact resides"
    )
    serviceAccountKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="ServiceAccountKeySecret is the secret selector to the bucket's service account key",
    )


class GitArtifact(BaseModel):
    depth: Optional[int] = Field(
        None,
        description="Depth specifies clones/fetches should be shallow and include the given number of commits from the branch tip",
    )
    fetch: Optional[List[str]] = Field(
        None,
        description="Fetch specifies a number of refs that should be fetched before checkout",
    )
    insecureIgnoreHostKey: Optional[bool] = Field(
        None,
        description="InsecureIgnoreHostKey disables SSH strict host key checking during git clone",
    )
    passwordSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="PasswordSecret is the secret selector to the repository password",
    )
    repo: str = Field(..., description="Repo is the git repository")
    revision: Optional[str] = Field(
        None, description="Revision is the git commit, tag, branch to checkout"
    )
    sshPrivateKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="SSHPrivateKeySecret is the secret selector to the repository ssh private key",
    )
    usernameSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="UsernameSecret is the secret selector to the repository username",
    )


class HDFSArtifact(BaseModel):
    addresses: Optional[List[str]] = Field(
        None, description="Addresses is accessible addresses of HDFS name nodes"
    )
    force: Optional[bool] = Field(
        None,
        description="Force copies a file forcibly even if it exists (default: false)",
    )
    hdfsUser: Optional[str] = Field(
        None,
        description="HDFSUser is the user to access HDFS file system. It is ignored if either ccache or keytab is used.",
    )
    krbCCacheSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="KrbCCacheSecret is the secret selector for Kerberos ccache Either ccache or keytab can be set to use Kerberos.",
    )
    krbConfigConfigMap: Optional[v1.ConfigMapKeySelector] = Field(
        None,
        description="KrbConfig is the configmap selector for Kerberos config as string It must be set if either ccache or keytab is used.",
    )
    krbKeytabSecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="KrbKeytabSecret is the secret selector for Kerberos keytab Either ccache or keytab can be set to use Kerberos.",
    )
    krbRealm: Optional[str] = Field(
        None,
        description="KrbRealm is the Kerberos realm used with Kerberos keytab It must be set if keytab is used.",
    )
    krbServicePrincipalName: Optional[str] = Field(
        None,
        description="KrbServicePrincipalName is the principal name of Kerberos service It must be set if either ccache or keytab is used.",
    )
    krbUsername: Optional[str] = Field(
        None,
        description="KrbUsername is the Kerberos username used with Kerberos keytab It must be set if keytab is used.",
    )
    path: str = Field(..., description="Path is a file path in HDFS")


class HTTPArtifact(BaseModel):
    headers: Optional[List[Header]] = Field(
        None,
        description="Headers are an optional list of headers to send with HTTP requests for artifacts",
    )
    url: str = Field(..., description="URL of the artifact")


class InfoResponse(BaseModel):
    links: Optional[List[Link]] = None
    managedNamespace: Optional[str] = None


class Memoize(BaseModel):
    cache: Cache = Field(..., description="Cache sets and configures the kind of cache")
    key: str = Field(..., description="Key is the key to use as the caching key")
    maxAge: str = Field(
        ...,
        description='MaxAge is the maximum age (e.g. "180s", "24h") of an entry that is still considered valid. If an entry is older than the MaxAge, it will be ignored.',
    )


class Metrics(BaseModel):
    prometheus: List[Prometheus] = Field(
        ..., description="Prometheus is a list of prometheus metrics to be emitted"
    )


class OSSArtifact(BaseModel):
    accessKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="AccessKeySecret is the secret selector to the bucket's access key",
    )
    bucket: Optional[str] = Field(None, description="Bucket is the name of the bucket")
    createBucketIfNotPresent: Optional[bool] = Field(
        None,
        description="CreateBucketIfNotPresent tells the driver to attempt to create the OSS bucket for output artifacts, if it doesn't exist",
    )
    endpoint: Optional[str] = Field(
        None, description="Endpoint is the hostname of the bucket endpoint"
    )
    key: str = Field(
        ..., description="Key is the path in the bucket where the artifact resides"
    )
    secretKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="SecretKeySecret is the secret selector to the bucket's secret key",
    )


class Parameter(BaseModel):
    default: Optional[str] = Field(
        None,
        description="Default is the default value to use for an input parameter if a value was not supplied",
    )
    enum: Optional[List[str]] = Field(
        None,
        description="Enum holds a list of string values to choose from, for the actual value of the parameter",
    )
    globalName: Optional[str] = Field(
        None,
        description="GlobalName exports an output parameter to the global scope, making it available as '{{io.argoproj.workflow.v1alpha1.outputs.parameters.XXXX}} and in workflow.status.outputs.parameters",
    )
    name: str = Field(..., description="Name is the parameter name")
    value: Optional[str] = Field(
        None,
        description="Value is the literal value to use for the parameter. If specified in the context of an input parameter, the value takes precedence over any passed values",
    )
    valueFrom: Optional[ValueFrom] = Field(
        None, description="ValueFrom is the source for the output parameter's value"
    )


class RetryAffinity(BaseModel):
    nodeAntiAffinity: Optional[RetryNodeAntiAffinity] = None


class RetryStrategy(BaseModel):
    affinity: Optional[RetryAffinity] = Field(
        None, description="Affinity prevents running workflow's step on the same host"
    )
    backoff: Optional[Backoff] = Field(
        None, description="Backoff is a backoff strategy"
    )
    limit: Optional[intstr.IntOrString] = Field(
        None,
        description="Limit is the maximum number of attempts when retrying a container",
    )
    retryPolicy: Optional[str] = Field(
        None,
        description="RetryPolicy is a policy of NodePhase statuses that will be retried",
    )


class S3Artifact(BaseModel):
    accessKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="AccessKeySecret is the secret selector to the bucket's access key",
    )
    bucket: Optional[str] = Field(None, description="Bucket is the name of the bucket")
    createBucketIfNotPresent: Optional[CreateS3BucketOptions] = Field(
        None,
        description="CreateBucketIfNotPresent tells the driver to attempt to create the S3 bucket for output artifacts, if it doesn't exist",
    )
    endpoint: Optional[str] = Field(
        None, description="Endpoint is the hostname of the bucket endpoint"
    )
    insecure: Optional[bool] = Field(
        None, description="Insecure will connect to the service with TLS"
    )
    key: str = Field(
        ..., description="Key is the key in the bucket where the artifact resides"
    )
    region: Optional[str] = Field(
        None, description="Region contains the optional bucket region"
    )
    roleARN: Optional[str] = Field(
        None,
        description="RoleARN is the Amazon Resource Name (ARN) of the role to assume.",
    )
    secretKeySecret: Optional[v1.SecretKeySelector] = Field(
        None,
        description="SecretKeySecret is the secret selector to the bucket's secret key",
    )
    useSDKCreds: Optional[bool] = Field(
        None,
        description="UseSDKCreds tells the driver to figure out credentials based on sdk defaults.",
    )


class SemaphoreRef(BaseModel):
    configMapKeyRef: Optional[v1.ConfigMapKeySelector] = Field(
        None,
        description="ConfigMapKeyRef is configmap selector for Semaphore configuration",
    )


class Sequence(BaseModel):
    count: Optional[intstr.IntOrString] = Field(
        None,
        description="Count is number of elements in the sequence (default: 0). Not to be used with end",
    )
    end: Optional[intstr.IntOrString] = Field(
        None,
        description="Number at which to end the sequence (default: 0). Not to be used with Count",
    )
    format: Optional[str] = Field(
        None,
        description="Format is a printf format string to format the value in the sequence",
    )
    start: Optional[intstr.IntOrString] = Field(
        None, description="Number at which to start the sequence (default: 0)"
    )


class SubmitOpts(BaseModel):
    annotations: Optional[str] = Field(
        None, description="Annotations adds to metadata.labels"
    )
    dryRun: Optional[bool] = Field(
        None,
        description="DryRun validates the workflow on the client-side without creating it. This option is not supported in API",
    )
    entryPoint: Optional[str] = Field(
        None, description="Entrypoint overrides spec.entrypoint"
    )
    generateName: Optional[str] = Field(
        None, description="GenerateName overrides metadata.generateName"
    )
    labels: Optional[str] = Field(None, description="Labels adds to metadata.labels")
    name: Optional[str] = Field(None, description="Name overrides metadata.name")
    ownerReference: Optional[v1_1.OwnerReference] = Field(
        None, description="OwnerReference creates a metadata.ownerReference"
    )
    parameterFile: Optional[str] = Field(
        None,
        description="ParameterFile holds a reference to a parameter file. This option is not supported in API",
    )
    parameters: Optional[List[str]] = Field(
        None, description="Parameters passes input parameters to workflow"
    )
    serverDryRun: Optional[bool] = Field(
        None,
        description="ServerDryRun validates the workflow on the server-side without creating it",
    )
    serviceAccount: Optional[str] = Field(
        None,
        description="ServiceAccount runs all pods in the workflow using specified ServiceAccount.",
    )


class Synchronization(BaseModel):
    mutex: Optional[Mutex] = Field(
        None, description="Mutex holds the Mutex lock details"
    )
    semaphore: Optional[SemaphoreRef] = Field(
        None, description="Semaphore holds the Semaphore configuration"
    )


class WorkflowSubmitRequest(BaseModel):
    namespace: Optional[str] = None
    resourceKind: Optional[str] = None
    resourceName: Optional[str] = None
    submitOptions: Optional[SubmitOpts] = None


class Artifact(BaseModel):
    archive: Optional[ArchiveStrategy] = Field(
        None,
        description="Archive controls how the artifact will be saved to the artifact repository.",
    )
    archiveLogs: Optional[bool] = Field(
        None,
        description="ArchiveLogs indicates if the container logs should be archived",
    )
    artifactory: Optional[ArtifactoryArtifact] = Field(
        None, description="Artifactory contains artifactory artifact location details"
    )
    from_: Optional[str] = Field(
        None,
        alias="from",
        description="From allows an artifact to reference an artifact from a previous step",
    )
    gcs: Optional[GCSArtifact] = Field(
        None, description="GCS contains GCS artifact location details"
    )
    git: Optional[GitArtifact] = Field(
        None, description="Git contains git artifact location details"
    )
    globalName: Optional[str] = Field(
        None,
        description="GlobalName exports an output artifact to the global scope, making it available as '{{io.argoproj.workflow.v1alpha1.outputs.artifacts.XXXX}} and in workflow.status.outputs.artifacts",
    )
    hdfs: Optional[HDFSArtifact] = Field(
        None, description="HDFS contains HDFS artifact location details"
    )
    http: Optional[HTTPArtifact] = Field(
        None, description="HTTP contains HTTP artifact location details"
    )
    mode: Optional[int] = Field(
        None,
        description="mode bits to use on this file, must be a value between 0 and 0777 set when loading input artifacts.",
    )
    name: str = Field(
        ...,
        description="name of the artifact. must be unique within a template's inputs/outputs.",
    )
    optional: Optional[bool] = Field(
        None,
        description="Make Artifacts optional, if Artifacts doesn't generate or exist",
    )
    oss: Optional[OSSArtifact] = Field(
        None, description="OSS contains OSS artifact location details"
    )
    path: Optional[str] = Field(
        None, description="Path is the container path to the artifact"
    )
    raw: Optional[RawArtifact] = Field(
        None, description="Raw contains raw artifact location details"
    )
    recurseMode: Optional[bool] = Field(
        None,
        description="If mode is set, apply the permission recursively into the artifact if it is a folder",
    )
    s3: Optional[S3Artifact] = Field(
        None, description="S3 contains S3 artifact location details"
    )
    subPath: Optional[str] = Field(
        None,
        description="SubPath allows an artifact to be sourced from a subpath within the specified source",
    )


class ArtifactLocation(BaseModel):
    archiveLogs: Optional[bool] = Field(
        None,
        description="ArchiveLogs indicates if the container logs should be archived",
    )
    artifactory: Optional[ArtifactoryArtifact] = Field(
        None, description="Artifactory contains artifactory artifact location details"
    )
    gcs: Optional[GCSArtifact] = Field(
        None, description="GCS contains GCS artifact location details"
    )
    git: Optional[GitArtifact] = Field(
        None, description="Git contains git artifact location details"
    )
    hdfs: Optional[HDFSArtifact] = Field(
        None, description="HDFS contains HDFS artifact location details"
    )
    http: Optional[HTTPArtifact] = Field(
        None, description="HTTP contains HTTP artifact location details"
    )
    oss: Optional[OSSArtifact] = Field(
        None, description="OSS contains OSS artifact location details"
    )
    raw: Optional[RawArtifact] = Field(
        None, description="Raw contains raw artifact location details"
    )
    s3: Optional[S3Artifact] = Field(
        None, description="S3 contains S3 artifact location details"
    )


class Inputs(BaseModel):
    artifacts: Optional[List[Artifact]] = Field(
        None, description="Artifact are a list of artifacts passed as inputs"
    )
    parameters: Optional[List[Parameter]] = Field(
        None, description="Parameters are a list of parameters passed as inputs"
    )


class Outputs(BaseModel):
    artifacts: Optional[List[Artifact]] = Field(
        None,
        description="Artifacts holds the list of output artifacts produced by a step",
    )
    exitCode: Optional[str] = Field(
        None, description="ExitCode holds the exit code of a script template"
    )
    parameters: Optional[List[Parameter]] = Field(
        None,
        description="Parameters holds the list of output parameters produced by a step",
    )
    result: Optional[str] = Field(
        None, description="Result holds the result (stdout) of a script template"
    )


class PodGC(BaseModel):
    labelSelector: Optional[v1_1.LabelSelector] = Field(
        None,
        description="LabelSelector is the label selector to check if the pods match the labels before being added to the pod GC queue.",
    )
    strategy: Optional[str] = Field(
        None,
        description='Strategy is the strategy to use. One of "OnPodCompletion", "OnPodSuccess", "OnWorkflowCompletion", "OnWorkflowSuccess"',
    )


class Arguments(BaseModel):
    artifacts: Optional[List[Artifact]] = Field(
        None,
        description="Artifacts is the list of artifacts to pass to the template or workflow",
    )
    parameters: Optional[List[Parameter]] = Field(
        None,
        description="Parameters is the list of parameters to pass to the template or workflow",
    )


class DAGTask(BaseModel):
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments are the parameter and artifact arguments to the template",
    )
    continueOn: Optional[ContinueOn] = Field(
        None,
        description="ContinueOn makes argo to proceed with the following step even if this step fails. Errors and Failed states can be specified",
    )
    dependencies: Optional[List[str]] = Field(
        None, description="Dependencies are name of other targets which this depends on"
    )
    depends: Optional[str] = Field(
        None, description="Depends are name of other targets which this depends on"
    )
    name: str = Field(..., description="Name is the name of the target")
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the template, irrespective of the success, failure, or error of the primary template.",
    )
    template: Optional[str] = Field(None, description="Name of template to execute")
    templateRef: Optional[TemplateRef] = Field(
        None,
        description="TemplateRef is the reference to the template resource to execute.",
    )
    when: Optional[str] = Field(
        None,
        description="When is an expression in which the task should conditionally execute",
    )
    withItems: Optional[List[Item]] = Field(
        None,
        description="WithItems expands a task into multiple parallel tasks from the items in the list",
    )
    withParam: Optional[str] = Field(
        None,
        description="WithParam expands a task into multiple parallel tasks from the value in the parameter, which is expected to be a JSON list.",
    )
    withSequence: Optional[Sequence] = Field(
        None, description="WithSequence expands a task into a numeric sequence"
    )


class DAGTemplate(BaseModel):
    failFast: Optional[bool] = Field(
        None,
        description='This flag is for DAG logic. The DAG logic has a built-in "fail fast" feature to stop scheduling new steps, as soon as it detects that one of the DAG nodes is failed. Then it waits until all DAG nodes are completed before failing the DAG itself. The FailFast flag default is true,  if set to false, it will allow a DAG to run all branches of the DAG to completion (either success or failure), regardless of the failed outcomes of branches in the DAG. More info and example about this feature at https://github.com/argoproj/argo_workflows/issues/1442',
    )
    target: Optional[str] = Field(
        None, description="Target are one or more names of targets to execute in a DAG"
    )
    tasks: List[DAGTask] = Field(..., description="Tasks are a list of DAG tasks")


class NodeStatus(BaseModel):
    boundaryID: Optional[str] = Field(
        None,
        description="BoundaryID indicates the node ID of the associated template root node in which this node belongs to",
    )
    children: Optional[List[str]] = Field(
        None, description="Children is a list of child node IDs"
    )
    daemoned: Optional[bool] = Field(
        None,
        description="Daemoned tracks whether or not this node was daemoned and need to be terminated",
    )
    displayName: Optional[str] = Field(
        None,
        description="DisplayName is a human readable representation of the node. Unique within a template boundary",
    )
    estimatedDuration: Optional[int] = Field(
        None, description="EstimatedDuration in seconds."
    )
    finishedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this node completed"
    )
    hostNodeName: Optional[str] = Field(
        None,
        description="HostNodeName name of the Kubernetes node on which the Pod is running, if applicable",
    )
    id: str = Field(
        ...,
        description="ID is a unique identifier of a node within the worklow It is implemented as a hash of the node name, which makes the ID deterministic",
    )
    inputs: Optional[Inputs] = Field(
        None,
        description="Inputs captures input parameter values and artifact locations supplied to this template invocation",
    )
    memoizationStatus: Optional[MemoizationStatus] = Field(
        None, description="MemoizationStatus holds information about cached nodes"
    )
    message: Optional[str] = Field(
        None,
        description="A human readable message indicating details about why the node is in this condition.",
    )
    name: str = Field(
        ...,
        description="Name is unique name in the node tree used to generate the node ID",
    )
    outboundNodes: Optional[List[str]] = Field(
        None,
        description='OutboundNodes tracks the node IDs which are considered "outbound" nodes to a template invocation. For every invocation of a template, there are nodes which we considered as "outbound". Essentially, these are last nodes in the execution sequence to run, before the template is considered completed. These nodes are then connected as parents to a following step.\n\nIn the case of single pod steps (i.e. container, script, resource templates), this list will be nil since the pod itself is already considered the "outbound" node. In the case of DAGs, outbound nodes are the "target" tasks (tasks with no children). In the case of steps, outbound nodes are all the containers involved in the last step group. NOTE: since templates are composable, the list of outbound nodes are carried upwards when a DAG/steps template invokes another DAG/steps template. In other words, the outbound nodes of a template, will be a superset of the outbound nodes of its last children.',
    )
    outputs: Optional[Outputs] = Field(
        None,
        description="Outputs captures output parameter values and artifact locations produced by this template invocation",
    )
    phase: Optional[str] = Field(
        None,
        description="Phase a simple, high-level summary of where the node is in its lifecycle. Can be used as a state machine.",
    )
    podIP: Optional[str] = Field(
        None, description="PodIP captures the IP of the pod for daemoned steps"
    )
    progress: Optional[str] = Field(None, description="Progress to completion")
    resourcesDuration: Optional[Dict[str, int]] = Field(
        None,
        description="ResourcesDuration is indicative, but not accurate, resource duration. This is populated when the nodes completes.",
    )
    startedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this node started"
    )
    synchronizationStatus: Optional[NodeSynchronizationStatus] = Field(
        None,
        description="SynchronizationStatus is the synchronization status of the node",
    )
    templateName: Optional[str] = Field(
        None,
        description="TemplateName is the template name which this node corresponds to. Not applicable to virtual nodes (e.g. Retry, StepGroup)",
    )
    templateRef: Optional[TemplateRef] = Field(
        None,
        description="TemplateRef is the reference to the template resource which this node corresponds to. Not applicable to virtual nodes (e.g. Retry, StepGroup)",
    )
    templateScope: Optional[str] = Field(
        None,
        description="TemplateScope is the template scope in which the template of this node was retrieved.",
    )
    type: str = Field(..., description="Type indicates type of node")


class Submit(BaseModel):
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments extracted from the event and then set as arguments to the workflow created.",
    )
    metadata: Optional[v1_1.ObjectMeta] = Field(
        None,
        description="Metadata optional means to customize select fields of the workflow metadata",
    )
    workflowTemplateRef: WorkflowTemplateRef = Field(
        ..., description="WorkflowTemplateRef the workflow template to submit"
    )


class WorkflowEventBindingSpec(BaseModel):
    event: Event = Field(..., description="Event is the event to bind to")
    submit: Optional[Submit] = Field(
        None, description="Submit is the workflow template to submit"
    )


class WorkflowStep(BaseModel):
    arguments: Optional[Arguments] = Field(
        None, description="Arguments hold arguments to the template"
    )
    continueOn: Optional[ContinueOn] = Field(
        None,
        description="ContinueOn makes argo to proceed with the following step even if this step fails. Errors and Failed states can be specified",
    )
    name: Optional[str] = Field(None, description="Name of the step")
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the template, irrespective of the success, failure, or error of the primary template.",
    )
    template: Optional[str] = Field(
        None, description="Template is the name of the template to execute as the step"
    )
    templateRef: Optional[TemplateRef] = Field(
        None,
        description="TemplateRef is the reference to the template resource to execute as the step.",
    )
    when: Optional[str] = Field(
        None,
        description="When is an expression in which the step should conditionally execute",
    )
    withItems: Optional[List[Item]] = Field(
        None,
        description="WithItems expands a step into multiple parallel steps from the items in the list",
    )
    withParam: Optional[str] = Field(
        None,
        description="WithParam expands a step into multiple parallel steps from the value in the parameter, which is expected to be a JSON list.",
    )
    withSequence: Optional[Sequence] = Field(
        None, description="WithSequence expands a step into a numeric sequence"
    )


class ParallelSteps(BaseModel):
    __root__: List[WorkflowStep]


class ScriptTemplate(BaseModel):
    args: Optional[List[str]] = Field(
        None,
        description="Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    command: Optional[List[str]] = Field(
        None,
        description="Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    env: Optional[List[v1.EnvVar]] = Field(
        None,
        description="List of environment variables to set in the container. Cannot be updated.",
    )
    envFrom: Optional[List[v1.EnvFromSource]] = Field(
        None,
        description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
    )
    image: str = Field(
        ...,
        description="Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.",
    )
    imagePullPolicy: Optional[str] = Field(
        None,
        description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images",
    )
    lifecycle: Optional[v1.Lifecycle] = Field(
        None,
        description="Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
    )
    livenessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    name: Optional[str] = Field(
        None,
        description="Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.",
    )
    ports: Optional[List[v1.ContainerPort]] = Field(
        None,
        description='List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Cannot be updated.',
    )
    readinessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    resources: Optional[v1.ResourceRequirements] = Field(
        None,
        description="Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
    )
    securityContext: Optional[v1.SecurityContext] = Field(
        None,
        description="Security options the pod should run with. More info: https://kubernetes.io/docs/concepts/policy/security-context/ More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/",
    )
    source: str = Field(
        ..., description="Source contains the source code of the script to execute"
    )
    startupProbe: Optional[v1.Probe] = Field(
        None,
        description="StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. This is a beta feature enabled by the StartupProbe feature flag. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    stdin: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.",
    )
    stdinOnce: Optional[bool] = Field(
        None,
        description="Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false",
    )
    terminationMessagePath: Optional[str] = Field(
        None,
        description="Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.",
    )
    terminationMessagePolicy: Optional[str] = Field(
        None,
        description="Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.",
    )
    tty: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.",
    )
    volumeDevices: Optional[List[v1.VolumeDevice]] = Field(
        None,
        description="volumeDevices is the list of block devices to be used by the container.",
    )
    volumeMounts: Optional[List[v1.VolumeMount]] = Field(
        None,
        description="Pod volumes to mount into the container's filesystem. Cannot be updated.",
    )
    workingDir: Optional[str] = Field(
        None,
        description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
    )


class UserContainer(BaseModel):
    args: Optional[List[str]] = Field(
        None,
        description="Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    command: Optional[List[str]] = Field(
        None,
        description="Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell",
    )
    env: Optional[List[v1.EnvVar]] = Field(
        None,
        description="List of environment variables to set in the container. Cannot be updated.",
    )
    envFrom: Optional[List[v1.EnvFromSource]] = Field(
        None,
        description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
    )
    image: Optional[str] = Field(
        None,
        description="Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.",
    )
    imagePullPolicy: Optional[str] = Field(
        None,
        description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images",
    )
    lifecycle: Optional[v1.Lifecycle] = Field(
        None,
        description="Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
    )
    livenessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    mirrorVolumeMounts: Optional[bool] = Field(
        None,
        description="MirrorVolumeMounts will mount the same volumes specified in the main container to the container (including artifacts), at the same mountPaths. This enables dind daemon to partially see the same filesystem as the main container in order to use features such as docker volume binding",
    )
    name: str = Field(
        ...,
        description="Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.",
    )
    ports: Optional[List[v1.ContainerPort]] = Field(
        None,
        description='List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Cannot be updated.',
    )
    readinessProbe: Optional[v1.Probe] = Field(
        None,
        description="Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    resources: Optional[v1.ResourceRequirements] = Field(
        None,
        description="Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
    )
    securityContext: Optional[v1.SecurityContext] = Field(
        None,
        description="Security options the pod should run with. More info: https://kubernetes.io/docs/concepts/policy/security-context/ More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/",
    )
    startupProbe: Optional[v1.Probe] = Field(
        None,
        description="StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. This is a beta feature enabled by the StartupProbe feature flag. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
    )
    stdin: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.",
    )
    stdinOnce: Optional[bool] = Field(
        None,
        description="Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false",
    )
    terminationMessagePath: Optional[str] = Field(
        None,
        description="Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.",
    )
    terminationMessagePolicy: Optional[str] = Field(
        None,
        description="Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.",
    )
    tty: Optional[bool] = Field(
        None,
        description="Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.",
    )
    volumeDevices: Optional[List[v1.VolumeDevice]] = Field(
        None,
        description="volumeDevices is the list of block devices to be used by the container.",
    )
    volumeMounts: Optional[List[v1.VolumeMount]] = Field(
        None,
        description="Pod volumes to mount into the container's filesystem. Cannot be updated.",
    )
    workingDir: Optional[str] = Field(
        None,
        description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
    )


class WorkflowEventBinding(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowEventBindingSpec


class WorkflowEventBindingList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[WorkflowEventBinding]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class Template(BaseModel):
    activeDeadlineSeconds: Optional[intstr.IntOrString] = Field(
        None,
        description="Optional duration in seconds relative to the StartTime that the pod may be active on a node before the system actively tries to terminate the pod; value must be positive integer This field is only applicable to container and script templates.",
    )
    affinity: Optional[v1.Affinity] = Field(
        None,
        description="Affinity sets the pod's scheduling constraints Overrides the affinity set at the workflow level (if any)",
    )
    archiveLocation: Optional[ArtifactLocation] = Field(
        None,
        description="Location in which all files related to the step will be stored (logs, artifacts, etc...). Can be overridden by individual items in Outputs. If omitted, will use the default artifact repository location configured in the controller, appended with the <workflowname>/<nodename> in the key.",
    )
    automountServiceAccountToken: Optional[bool] = Field(
        None,
        description="AutomountServiceAccountToken indicates whether a service account token should be automatically mounted in pods. ServiceAccountName of ExecutorConfig must be specified if this value is false.",
    )
    container: Optional[v1.Container] = Field(
        None, description="Container is the main container image to run in the pod"
    )
    daemon: Optional[bool] = Field(
        None,
        description="Deamon will allow a workflow to proceed to the next step so long as the container reaches readiness",
    )
    dag: Optional[DAGTemplate] = Field(
        None, description="DAG template subtype which runs a DAG"
    )
    executor: Optional[ExecutorConfig] = Field(
        None, description="Executor holds configurations of the executor container."
    )
    hostAliases: Optional[List[v1.HostAlias]] = Field(
        None,
        description="HostAliases is an optional list of hosts and IPs that will be injected into the pod spec",
    )
    initContainers: Optional[List[UserContainer]] = Field(
        None,
        description="InitContainers is a list of containers which run before the main container.",
    )
    inputs: Optional[Inputs] = Field(
        None,
        description="Inputs describe what inputs parameters and artifacts are supplied to this template",
    )
    memoize: Optional[Memoize] = Field(
        None,
        description="Memoize allows templates to use outputs generated from already executed templates",
    )
    metadata: Optional[Metadata] = Field(
        None,
        description="Metdata sets the pods's metadata, i.e. annotations and labels",
    )
    metrics: Optional[Metrics] = Field(
        None, description="Metrics are a list of metrics emitted from this template"
    )
    name: str = Field(..., description="Name is the name of the template")
    nodeSelector: Optional[Dict[str, str]] = Field(
        None,
        description="NodeSelector is a selector to schedule this step of the workflow to be run on the selected node(s). Overrides the selector set at the workflow level.",
    )
    outputs: Optional[Outputs] = Field(
        None,
        description="Outputs describe the parameters and artifacts that this template produces",
    )
    parallelism: Optional[int] = Field(
        None,
        description="Parallelism limits the max total parallel pods that can execute at the same time within the boundaries of this template invocation. If additional steps/dag templates are invoked, the pods created by those templates will not be counted towards this total.",
    )
    podSpecPatch: Optional[str] = Field(
        None,
        description="PodSpecPatch holds strategic merge patch to apply against the pod spec. Allows parameterization of container fields which are not strings (e.g. resource limits).",
    )
    priority: Optional[int] = Field(
        None, description="Priority to apply to workflow pods."
    )
    priorityClassName: Optional[str] = Field(
        None, description="PriorityClassName to apply to workflow pods."
    )
    resource: Optional[ResourceTemplate] = Field(
        None, description="Resource template subtype which can run k8s resources"
    )
    retryStrategy: Optional[RetryStrategy] = Field(
        None,
        description="RetryStrategy describes how to retry a template when it fails",
    )
    schedulerName: Optional[str] = Field(
        None,
        description="If specified, the pod will be dispatched by specified scheduler. Or it will be dispatched by workflow scope scheduler if specified. If neither specified, the pod will be dispatched by default scheduler.",
    )
    script: Optional[ScriptTemplate] = Field(
        None, description="Script runs a portion of code against an interpreter"
    )
    securityContext: Optional[v1.PodSecurityContext] = Field(
        None,
        description="SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty.  See type description for default values of each field.",
    )
    serviceAccountName: Optional[str] = Field(
        None, description="ServiceAccountName to apply to workflow pods"
    )
    sidecars: Optional[List[UserContainer]] = Field(
        None,
        description="Sidecars is a list of containers which run alongside the main container Sidecars are automatically killed when the main container completes",
    )
    steps: Optional[List[ParallelSteps]] = Field(
        None, description="Steps define a series of sequential/parallel workflow steps"
    )
    suspend: Optional[SuspendTemplate] = Field(
        None,
        description="Suspend template subtype which can suspend a workflow when reaching the step",
    )
    synchronization: Optional[Synchronization] = Field(
        None,
        description="Synchronization holds synchronization lock configuration for this template",
    )
    timeout: Optional[str] = Field(
        None,
        description="Timout allows to set the total node execution timeout duration counting from the node's start time. This duration also includes time in which the node spends in Pending state. This duration may not be applied to Step or DAG templates.",
    )
    tolerations: Optional[List[v1.Toleration]] = Field(
        None, description="Tolerations to apply to workflow pods."
    )
    volumes: Optional[List[v1.Volume]] = Field(
        None,
        description="Volumes is a list of volumes that can be mounted by containers in a template.",
    )


class WorkflowSpec(BaseModel):
    activeDeadlineSeconds: Optional[int] = Field(
        None,
        description="Optional duration in seconds relative to the workflow start time which the workflow is allowed to run before the controller terminates the io.argoproj.workflow.v1alpha1. A value of zero is used to terminate a Running workflow",
    )
    affinity: Optional[v1.Affinity] = Field(
        None,
        description="Affinity sets the scheduling constraints for all pods in the io.argoproj.workflow.v1alpha1. Can be overridden by an affinity specified in the template",
    )
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments contain the parameters and artifacts sent to the workflow entrypoint Parameters are referencable globally using the 'workflow' variable prefix. e.g. {{io.argoproj.workflow.v1alpha1.parameters.myparam}}",
    )
    artifactRepositoryRef: Optional[ArtifactRepositoryRef] = Field(
        None,
        description="ArtifactRepositoryRef specifies the configMap name and key containing the artifact repository config.",
    )
    automountServiceAccountToken: Optional[bool] = Field(
        None,
        description="AutomountServiceAccountToken indicates whether a service account token should be automatically mounted in pods. ServiceAccountName of ExecutorConfig must be specified if this value is false.",
    )
    dnsConfig: Optional[v1.PodDNSConfig] = Field(
        None,
        description="PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.",
    )
    dnsPolicy: Optional[str] = Field(
        None,
        description="Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.",
    )
    entrypoint: Optional[str] = Field(
        None,
        description="Entrypoint is a template reference to the starting point of the io.argoproj.workflow.v1alpha1.",
    )
    executor: Optional[ExecutorConfig] = Field(
        None,
        description="Executor holds configurations of executor containers of the io.argoproj.workflow.v1alpha1.",
    )
    hostAliases: Optional[List[v1.HostAlias]] = None
    hostNetwork: Optional[bool] = Field(
        None,
        description="Host networking requested for this workflow pod. Default to false.",
    )
    imagePullSecrets: Optional[List[v1.LocalObjectReference]] = Field(
        None,
        description="ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod",
    )
    metrics: Optional[Metrics] = Field(
        None, description="Metrics are a list of metrics emitted from this Workflow"
    )
    nodeSelector: Optional[Dict[str, str]] = Field(
        None,
        description="NodeSelector is a selector which will result in all pods of the workflow to be scheduled on the selected node(s). This is able to be overridden by a nodeSelector specified in the template.",
    )
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the workflow, irrespective of the success, failure, or error of the primary io.argoproj.workflow.v1alpha1.",
    )
    parallelism: Optional[int] = Field(
        None,
        description="Parallelism limits the max total parallel pods that can execute at the same time in a workflow",
    )
    podDisruptionBudget: Optional[v1beta1.PodDisruptionBudgetSpec] = Field(
        None,
        description="PodDisruptionBudget holds the number of concurrent disruptions that you allow for Workflow's Pods. Controller will automatically add the selector with workflow name, if selector is empty. Optional: Defaults to empty.",
    )
    podGC: Optional[PodGC] = Field(
        None,
        description="PodGC describes the strategy to use when to deleting completed pods",
    )
    podMetadata: Optional[Metadata] = Field(
        None,
        description="PodMetadata defines additional metadata that should be applied to workflow pods",
    )
    podPriority: Optional[int] = Field(
        None, description="Priority to apply to workflow pods."
    )
    podPriorityClassName: Optional[str] = Field(
        None, description="PriorityClassName to apply to workflow pods."
    )
    podSpecPatch: Optional[str] = Field(
        None,
        description="PodSpecPatch holds strategic merge patch to apply against the pod spec. Allows parameterization of container fields which are not strings (e.g. resource limits).",
    )
    priority: Optional[int] = Field(
        None,
        description="Priority is used if controller is configured to process limited number of workflows in parallel. Workflows with higher priority are processed first.",
    )
    retryStrategy: Optional[RetryStrategy] = Field(
        None,
        description="RetryStrategy for all templates in the io.argoproj.workflow.v1alpha1.",
    )
    schedulerName: Optional[str] = Field(
        None,
        description="Set scheduler name for all pods. Will be overridden if container/script template's scheduler name is set. Default scheduler will be used if neither specified.",
    )
    securityContext: Optional[v1.PodSecurityContext] = Field(
        None,
        description="SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty.  See type description for default values of each field.",
    )
    serviceAccountName: Optional[str] = Field(
        None,
        description="ServiceAccountName is the name of the ServiceAccount to run all pods of the workflow as.",
    )
    shutdown: Optional[str] = Field(
        None,
        description="Shutdown will shutdown the workflow according to its ShutdownStrategy",
    )
    suspend: Optional[bool] = Field(
        None,
        description="Suspend will suspend the workflow and prevent execution of any future steps in the workflow",
    )
    synchronization: Optional[Synchronization] = Field(
        None,
        description="Synchronization holds synchronization lock configuration for this Workflow",
    )
    templates: Optional[List[Template]] = Field(
        None, description="Templates is a list of workflow templates used in a workflow"
    )
    tolerations: Optional[List[v1.Toleration]] = Field(
        None, description="Tolerations to apply to workflow pods."
    )
    ttlStrategy: Optional[TTLStrategy] = Field(
        None,
        description="TTLStrategy limits the lifetime of a Workflow that has finished execution depending on if it Succeeded or Failed. If this struct is set, once the Workflow finishes, it will be deleted after the time to live expires. If this field is unset, the controller config map will hold the default values.",
    )
    volumeClaimGC: Optional[VolumeClaimGC] = Field(
        None,
        description="VolumeClaimGC describes the strategy to use when to deleting volumes from completed workflows",
    )
    volumeClaimTemplates: Optional[List[v1.PersistentVolumeClaim]] = Field(
        None,
        description="VolumeClaimTemplates is a list of claims that containers are allowed to reference. The Workflow controller will create the claims at the beginning of the workflow and delete the claims upon completion of the workflow",
    )
    volumes: Optional[List[v1.Volume]] = Field(
        None,
        description="Volumes is a list of volumes that can be mounted by containers in a io.argoproj.workflow.v1alpha1.",
    )
    workflowTemplateRef: Optional[WorkflowTemplateRef] = Field(
        None,
        description="WorkflowTemplateRef holds a reference to a WorkflowTemplate for execution",
    )


class WorkflowStatus(BaseModel):
    artifactRepositoryRef: Optional[ArtifactRepositoryRefStatus] = Field(
        None,
        description="ArtifactRepositoryRef is used to cache the repository to use so we do not need to determine it everytime we reconcile.",
    )
    compressedNodes: Optional[str] = Field(
        None, description="Compressed and base64 decoded Nodes map"
    )
    conditions: Optional[List[Condition]] = Field(
        None, description="Conditions is a list of conditions the Workflow may have"
    )
    estimatedDuration: Optional[int] = Field(
        None, description="EstimatedDuration in seconds."
    )
    finishedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this workflow completed"
    )
    message: Optional[str] = Field(
        None,
        description="A human readable message indicating details about why the workflow is in this condition.",
    )
    nodes: Optional[Dict[str, NodeStatus]] = Field(
        None, description="Nodes is a mapping between a node ID and the node's status."
    )
    offloadNodeStatusVersion: Optional[str] = Field(
        None,
        description="Whether on not node status has been offloaded to a database. If exists, then Nodes and CompressedNodes will be empty. This will actually be populated with a hash of the offloaded data.",
    )
    outputs: Optional[Outputs] = Field(
        None,
        description="Outputs captures output values and artifact locations produced by the workflow via global outputs",
    )
    persistentVolumeClaims: Optional[List[v1.Volume]] = Field(
        None,
        description="PersistentVolumeClaims tracks all PVCs that were created as part of the io.argoproj.workflow.v1alpha1. The contents of this list are drained at the end of the workflow.",
    )
    phase: Optional[str] = Field(
        None,
        description="Phase a simple, high-level summary of where the workflow is in its lifecycle.",
    )
    progress: Optional[str] = Field(None, description="Progress to completion")
    resourcesDuration: Optional[Dict[str, int]] = Field(
        None, description="ResourcesDuration is the total for the workflow"
    )
    startedAt: Optional[v1_1.Time] = Field(
        None, description="Time at which this workflow started"
    )
    storedTemplates: Optional[Dict[str, Template]] = Field(
        None,
        description="StoredTemplates is a mapping between a template ref and the node's status.",
    )
    storedWorkflowTemplateSpec: Optional[WorkflowSpec] = Field(
        None,
        description="StoredWorkflowSpec stores the WorkflowTemplate spec for future execution.",
    )
    synchronization: Optional[SynchronizationStatus] = Field(
        None, description="Synchronization stores the status of synchronization locks"
    )


class WorkflowTemplateSpec(BaseModel):
    activeDeadlineSeconds: Optional[int] = Field(
        None,
        description="Optional duration in seconds relative to the workflow start time which the workflow is allowed to run before the controller terminates the io.argoproj.workflow.v1alpha1. A value of zero is used to terminate a Running workflow",
    )
    affinity: Optional[v1.Affinity] = Field(
        None,
        description="Affinity sets the scheduling constraints for all pods in the io.argoproj.workflow.v1alpha1. Can be overridden by an affinity specified in the template",
    )
    arguments: Optional[Arguments] = Field(
        None,
        description="Arguments contain the parameters and artifacts sent to the workflow entrypoint Parameters are referencable globally using the 'workflow' variable prefix. e.g. {{io.argoproj.workflow.v1alpha1.parameters.myparam}}",
    )
    artifactRepositoryRef: Optional[ArtifactRepositoryRef] = Field(
        None,
        description="ArtifactRepositoryRef specifies the configMap name and key containing the artifact repository config.",
    )
    automountServiceAccountToken: Optional[bool] = Field(
        None,
        description="AutomountServiceAccountToken indicates whether a service account token should be automatically mounted in pods. ServiceAccountName of ExecutorConfig must be specified if this value is false.",
    )
    dnsConfig: Optional[v1.PodDNSConfig] = Field(
        None,
        description="PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.",
    )
    dnsPolicy: Optional[str] = Field(
        None,
        description="Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.",
    )
    entrypoint: Optional[str] = Field(
        None,
        description="Entrypoint is a template reference to the starting point of the io.argoproj.workflow.v1alpha1.",
    )
    executor: Optional[ExecutorConfig] = Field(
        None,
        description="Executor holds configurations of executor containers of the io.argoproj.workflow.v1alpha1.",
    )
    hostAliases: Optional[List[v1.HostAlias]] = None
    hostNetwork: Optional[bool] = Field(
        None,
        description="Host networking requested for this workflow pod. Default to false.",
    )
    imagePullSecrets: Optional[List[v1.LocalObjectReference]] = Field(
        None,
        description="ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod",
    )
    metrics: Optional[Metrics] = Field(
        None, description="Metrics are a list of metrics emitted from this Workflow"
    )
    nodeSelector: Optional[Dict[str, str]] = Field(
        None,
        description="NodeSelector is a selector which will result in all pods of the workflow to be scheduled on the selected node(s). This is able to be overridden by a nodeSelector specified in the template.",
    )
    onExit: Optional[str] = Field(
        None,
        description="OnExit is a template reference which is invoked at the end of the workflow, irrespective of the success, failure, or error of the primary io.argoproj.workflow.v1alpha1.",
    )
    parallelism: Optional[int] = Field(
        None,
        description="Parallelism limits the max total parallel pods that can execute at the same time in a workflow",
    )
    podDisruptionBudget: Optional[v1beta1.PodDisruptionBudgetSpec] = Field(
        None,
        description="PodDisruptionBudget holds the number of concurrent disruptions that you allow for Workflow's Pods. Controller will automatically add the selector with workflow name, if selector is empty. Optional: Defaults to empty.",
    )
    podGC: Optional[PodGC] = Field(
        None,
        description="PodGC describes the strategy to use when to deleting completed pods",
    )
    podMetadata: Optional[Metadata] = Field(
        None,
        description="PodMetadata defines additional metadata that should be applied to workflow pods",
    )
    podPriority: Optional[int] = Field(
        None, description="Priority to apply to workflow pods."
    )
    podPriorityClassName: Optional[str] = Field(
        None, description="PriorityClassName to apply to workflow pods."
    )
    podSpecPatch: Optional[str] = Field(
        None,
        description="PodSpecPatch holds strategic merge patch to apply against the pod spec. Allows parameterization of container fields which are not strings (e.g. resource limits).",
    )
    priority: Optional[int] = Field(
        None,
        description="Priority is used if controller is configured to process limited number of workflows in parallel. Workflows with higher priority are processed first.",
    )
    retryStrategy: Optional[RetryStrategy] = Field(
        None,
        description="RetryStrategy for all templates in the io.argoproj.workflow.v1alpha1.",
    )
    schedulerName: Optional[str] = Field(
        None,
        description="Set scheduler name for all pods. Will be overridden if container/script template's scheduler name is set. Default scheduler will be used if neither specified.",
    )
    securityContext: Optional[v1.PodSecurityContext] = Field(
        None,
        description="SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty.  See type description for default values of each field.",
    )
    serviceAccountName: Optional[str] = Field(
        None,
        description="ServiceAccountName is the name of the ServiceAccount to run all pods of the workflow as.",
    )
    shutdown: Optional[str] = Field(
        None,
        description="Shutdown will shutdown the workflow according to its ShutdownStrategy",
    )
    suspend: Optional[bool] = Field(
        None,
        description="Suspend will suspend the workflow and prevent execution of any future steps in the workflow",
    )
    synchronization: Optional[Synchronization] = Field(
        None,
        description="Synchronization holds synchronization lock configuration for this Workflow",
    )
    templates: Optional[List[Template]] = Field(
        None, description="Templates is a list of workflow templates used in a workflow"
    )
    tolerations: Optional[List[v1.Toleration]] = Field(
        None, description="Tolerations to apply to workflow pods."
    )
    ttlStrategy: Optional[TTLStrategy] = Field(
        None,
        description="TTLStrategy limits the lifetime of a Workflow that has finished execution depending on if it Succeeded or Failed. If this struct is set, once the Workflow finishes, it will be deleted after the time to live expires. If this field is unset, the controller config map will hold the default values.",
    )
    volumeClaimGC: Optional[VolumeClaimGC] = Field(
        None,
        description="VolumeClaimGC describes the strategy to use when to deleting volumes from completed workflows",
    )
    volumeClaimTemplates: Optional[List[v1.PersistentVolumeClaim]] = Field(
        None,
        description="VolumeClaimTemplates is a list of claims that containers are allowed to reference. The Workflow controller will create the claims at the beginning of the workflow and delete the claims upon completion of the workflow",
    )
    volumes: Optional[List[v1.Volume]] = Field(
        None,
        description="Volumes is a list of volumes that can be mounted by containers in a io.argoproj.workflow.v1alpha1.",
    )
    workflowMetadata: Optional[v1_1.ObjectMeta] = Field(
        None,
        description="WorkflowMetadata contains some metadata of the workflow to be refer",
    )
    workflowTemplateRef: Optional[WorkflowTemplateRef] = Field(
        None,
        description="WorkflowTemplateRef holds a reference to a WorkflowTemplate for execution",
    )


class ClusterWorkflowTemplate(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowTemplateSpec


class ClusterWorkflowTemplateCreateRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    template: Optional[ClusterWorkflowTemplate] = None


class ClusterWorkflowTemplateLintRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    template: Optional[ClusterWorkflowTemplate] = None


class ClusterWorkflowTemplateList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[ClusterWorkflowTemplate]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class ClusterWorkflowTemplateUpdateRequest(BaseModel):
    name: Optional[str] = Field(None, description="DEPRECATED: This field is ignored.")
    template: Optional[ClusterWorkflowTemplate] = None


class CronWorkflowSpec(BaseModel):
    concurrencyPolicy: Optional[str] = Field(
        None,
        description="ConcurrencyPolicy is the K8s-style concurrency policy that will be used",
    )
    failedJobsHistoryLimit: Optional[int] = Field(
        None,
        description="FailedJobsHistoryLimit is the number of failed jobs to be kept at a time",
    )
    schedule: str = Field(
        ..., description="Schedule is a schedule to run the Workflow in Cron format"
    )
    startingDeadlineSeconds: Optional[int] = Field(
        None,
        description="StartingDeadlineSeconds is the K8s-style deadline that will limit the time a CronWorkflow will be run after its original scheduled time if it is missed.",
    )
    successfulJobsHistoryLimit: Optional[int] = Field(
        None,
        description="SuccessfulJobsHistoryLimit is the number of successful jobs to be kept at a time",
    )
    suspend: Optional[bool] = Field(
        None,
        description="Suspend is a flag that will stop new CronWorkflows from running if set to true",
    )
    timezone: Optional[str] = Field(
        None,
        description='Timezone is the timezone against which the cron schedule will be calculated, e.g. "Asia/Tokyo". Default is machine\'s local time.',
    )
    workflowMetadata: Optional[v1_1.ObjectMeta] = Field(
        None,
        description="WorkflowMetadata contains some metadata of the workflow to be run",
    )
    workflowSpec: WorkflowSpec = Field(
        ..., description="WorkflowSpec is the spec of the workflow to be run"
    )


class Workflow(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowSpec
    status: Optional[WorkflowStatus] = None


class WorkflowCreateRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    instanceID: Optional[str] = Field(None, description="This field is no longer used.")
    namespace: Optional[str] = None
    serverDryRun: Optional[bool] = None
    workflow: Optional[Workflow] = None


class WorkflowLintRequest(BaseModel):
    namespace: Optional[str] = None
    workflow: Optional[Workflow] = None


class WorkflowList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[Workflow]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class WorkflowTemplate(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: WorkflowTemplateSpec


class WorkflowTemplateCreateRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    namespace: Optional[str] = None
    template: Optional[WorkflowTemplate] = None


class WorkflowTemplateLintRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    namespace: Optional[str] = None
    template: Optional[WorkflowTemplate] = None


class WorkflowTemplateList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[WorkflowTemplate]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class WorkflowTemplateUpdateRequest(BaseModel):
    name: Optional[str] = Field(None, description="DEPRECATED: This field is ignored.")
    namespace: Optional[str] = None
    template: Optional[WorkflowTemplate] = None


class WorkflowWatchEvent(BaseModel):
    object: Optional[Workflow] = Field(None, title="the workflow")
    type: Optional[str] = Field(None, title="the type of change")


class CronWorkflow(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ObjectMeta
    spec: CronWorkflowSpec
    status: Optional[CronWorkflowStatus] = None


class CronWorkflowList(BaseModel):
    apiVersion: Optional[str] = Field(
        None,
        description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#resources",
    )
    items: List[CronWorkflow]
    kind: Optional[str] = Field(
        None,
        description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.io.k8s.community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    )
    metadata: v1_1.ListMeta


class LintCronWorkflowRequest(BaseModel):
    cronWorkflow: Optional[CronWorkflow] = None
    namespace: Optional[str] = None


class UpdateCronWorkflowRequest(BaseModel):
    cronWorkflow: Optional[CronWorkflow] = None
    name: Optional[str] = Field(None, description="DEPRECATED: This field is ignored.")
    namespace: Optional[str] = None


class CreateCronWorkflowRequest(BaseModel):
    createOptions: Optional[v1_1.CreateOptions] = None
    cronWorkflow: Optional[CronWorkflow] = None
    namespace: Optional[str] = None

# generated by datamodel-codegen: #   filename:  https://raw.githubusercontent.com/argoproj/argo-workflows/stable/api/openapi-spec/swagger.json # disable resource validation\n]', #running-a-command-in-a-shell", #running-a-command-in-a-shell", #updating-images", #container-probes", #container-probes", #container-probes", #running-a-command-in-a-shell", #running-a-command-in-a-shell", #updating-images", #container-probes", #container-probes", #container-probes", #resources", #types-kinds", #resources", #types-kinds", #specifying-imagepullsecrets-on-a-pod", #specifying-imagepullsecrets-on-a-pod", #resources", #types-kinds", #resources", #types-kinds", #resources", #types-kinds", #resources", #types-kinds", #resources", #types-kinds", #resources", #types-kinds", #resources", #types-kinds", #resources", #types-kinds",