From e3bb1251306f3aa2c99c06653e5dcd3e9957f2e0 Mon Sep 17 00:00:00 2001 From: API Engineering Date: Tue, 19 Nov 2024 16:03:47 +0000 Subject: [PATCH] [bot] Updated client based on openapi-231e5bb/clientgen --- DO_OPENAPI_COMMIT_SHA.txt | 2 +- src/pydo/aio/operations/_operations.py | 4243 +++++++++++++++++++++++ src/pydo/operations/_operations.py | 4268 ++++++++++++++++++++++++ 3 files changed, 8512 insertions(+), 1 deletion(-) diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index f5797d2..8db07cf 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -de14248 +231e5bb diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index bc74701..df614a6 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -61,6 +61,7 @@ build_apps_list_metrics_bandwidth_daily_request, build_apps_list_regions_request, build_apps_list_request, + build_apps_restart_request, build_apps_revert_rollback_request, build_apps_update_request, build_apps_validate_app_spec_request, @@ -63404,6 +63405,4248 @@ async def update( return cast(JSON, deserialized) # type: ignore + @overload + async def restart( + self, + app_id: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Restart an App. + + Perform a rolling restart of all or specific components in an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "components": [ + "str" # Optional. Optional list of components to restart. If not + provided, all components will be restarted. + ] + } + + # response body for status code(s): 200 + response == { + "deployment": { + "cause": "str", # Optional. What caused this deployment to be + created. + "cloned_from": "str", # Optional. The ID of a previous deployment + that this deployment was cloned from. + "created_at": "2020-02-20 00:00:00", # Optional. The creation time + of the deployment. + "functions": [ + { + "name": "str", # Optional. The name of this + functions component. + "namespace": "str", # Optional. The namespace where + the functions are deployed. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this functions + component. + } + ], + "id": "str", # Optional. The ID of the deployment. + "jobs": [ + { + "name": "str", # Optional. The name of this job. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this job. + } + ], + "phase": "UNKNOWN", # Optional. Default value is "UNKNOWN". Known + values are: "UNKNOWN", "PENDING_BUILD", "BUILDING", "PENDING_DEPLOY", + "DEPLOYING", "ACTIVE", "SUPERSEDED", "ERROR", and "CANCELED". + "phase_last_updated_at": "2020-02-20 00:00:00", # Optional. When the + deployment phase was last updated. + "progress": { + "error_steps": 0, # Optional. Number of unsuccessful steps. + "pending_steps": 0, # Optional. Number of pending steps. + "running_steps": 0, # Optional. Number of currently running + steps. + "steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "success_steps": 0, # Optional. Number of successful steps. + "summary_steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "total_steps": 0 # Optional. Total number of steps. + }, + "services": [ + { + "name": "str", # Optional. The name of this service. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this service. + } + ], + "spec": { + "name": "str", # The name of the app. Must be unique across + all apps in the same account. Required. + "databases": [ + { + "name": "str", # The database's name. The + name must be unique across all components within the same app and + cannot use capital letters. Required. + "cluster_name": "str", # Optional. The name + of the underlying DigitalOcean DBaaS cluster. This is required + for production databases. For dev databases, if cluster_name is + not set, a new cluster will be provisioned. + "db_name": "str", # Optional. The name of + the MySQL or PostgreSQL database to configure. + "db_user": "str", # Optional. The name of + the MySQL or PostgreSQL user to configure. + "engine": "UNSET", # Optional. Default value + is "UNSET". * MYSQL: MySQL * PG: PostgreSQL * REDIS: Redis * + MONGODB: MongoDB * KAFKA: Kafka * OPENSEARCH: OpenSearch. Known + values are: "UNSET", "MYSQL", "PG", "REDIS", "MONGODB", "KAFKA", + and "OPENSEARCH". + "production": bool, # Optional. Whether this + is a production or dev database. + "version": "str" # Optional. The version of + the database engine. + } + ], + "domains": [ + { + "domain": "str", # The hostname for the + domain. Required. + "minimum_tls_version": "str", # Optional. + The minimum version of TLS a client application can use to access + resources for the domain. Must be one of the following values + wrapped within quotations: ``"1.2"`` or ``"1.3"``. Known values + are: "1.2" and "1.3". + "type": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * DEFAULT: The default + ``.ondigitalocean.app`` domain assigned to this app * PRIMARY: + The primary domain for this app that is displayed as the default + in the control panel, used in bindable environment variables, and + any other places that reference an app's live URL. Only one + domain may be set as primary. * ALIAS: A non-primary domain. + Known values are: "UNSPECIFIED", "DEFAULT", "PRIMARY", and + "ALIAS". + "wildcard": bool, # Optional. Indicates + whether the domain includes all sub-domains, in addition to the + given domain. + "zone": "str" # Optional. Optional. If the + domain uses DigitalOcean DNS and you would like App Platform to + automatically manage it for you, set this to the name of the + domain on your account. For example, If the domain you are + adding is ``app.domain.com``"" , the zone could be + ``domain.com``. + } + ], + "egress": { + "type": "AUTOASSIGN" # Optional. Default value is + "AUTOASSIGN". The app egress type. Known values are: "AUTOASSIGN" and + "DEDICATED_IP". + }, + "functions": [ + { + "name": "str", # The name. Must be unique + across all components within the same app. Required. + "alerts": [ + { + "disabled": bool, # + Optional. Is the alert disabled?. + "operator": + "UNSPECIFIED_OPERATOR", # Optional. Default value is + "UNSPECIFIED_OPERATOR". Known values are: + "UNSPECIFIED_OPERATOR", "GREATER_THAN", and "LESS_THAN". + "rule": "UNSPECIFIED_RULE", + # Optional. Default value is "UNSPECIFIED_RULE". Known + values are: "UNSPECIFIED_RULE", "CPU_UTILIZATION", + "MEM_UTILIZATION", "RESTART_COUNT", "DEPLOYMENT_FAILED", + "DEPLOYMENT_LIVE", "DOMAIN_FAILED", "DOMAIN_LIVE", + "FUNCTIONS_ACTIVATION_COUNT", + "FUNCTIONS_AVERAGE_DURATION_MS", + "FUNCTIONS_ERROR_RATE_PER_MINUTE", + "FUNCTIONS_AVERAGE_WAIT_TIME_MS", + "FUNCTIONS_ERROR_COUNT", and + "FUNCTIONS_GB_RATE_PER_SECOND". + "value": 0.0, # Optional. + Threshold value for alert. + "window": + "UNSPECIFIED_WINDOW" # Optional. Default value is + "UNSPECIFIED_WINDOW". Known values are: + "UNSPECIFIED_WINDOW", "FIVE_MINUTES", "TEN_MINUTES", + "THIRTY_MINUTES", and "ONE_HOUR". + } + ], + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "ingress": { + "rules": [ + { + "component": { + "name": "str", # The name of + the component to route to. Required. + "preserve_path_prefix": + "str", # Optional. An optional flag to preserve the path + that is forwarded to the backend service. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. Note: this is not applicable for + Functions Components and is mutually exclusive with + ``rewrite``. + "rewrite": "str" # Optional. + An optional field that will rewrite the path of the + component to be what is specified here. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If you specified the rewrite to be + ``/v1/``"" , requests to ``/api/list`` would be rewritten + to ``/v1/list``. Note: this is mutually exclusive with + ``preserve_path_prefix``. + }, + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to + the client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. + The set of allowed HTTP request headers. This + configures the ``Access-Control-Allow-Headers`` + header. + ], + "allow_methods": [ + "str" # Optional. + The set of allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": + "str", # Optional. Exact string match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "prefix": + "str", # Optional. Prefix-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "regex": + "str" # Optional. RE2 style regex-based match. + Only 1 of ``exact``"" , ``prefix``"" , or + ``regex`` must be set. For more information about + RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. + The set of HTTP response headers that browsers are + allowed to access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. + An optional duration specifying how long browsers can + cache the results of a preflight request. This configures + the ``Access-Control-Max-Age`` header. + }, + "match": { + "path": { + "prefix": "str" # + Prefix-based match. For example, ``/api`` will match + ``/api``"" , ``/api/``"" , and any nested paths such + as ``/api/v1/endpoint``. Required. + } + }, + "redirect": { + "authority": "str", # + Optional. The authority/host to redirect to. This can be + a hostname or IP address. Note: use ``port`` to set the + port. + "port": 0, # Optional. The + port to redirect to. + "redirect_code": 0, # + Optional. The redirect code to use. Defaults to ``302``. + Supported values are 300, 301, 302, 303, 304, 307, 308. + "scheme": "str", # Optional. + The scheme to redirect to. Supported values are ``http`` + or ``https``. Default: ``https``. + "uri": "str" # Optional. An + optional URI path to redirect to. Note: if this is + specified the whole URI of the original request will be + overwritten to this value, irrespective of the original + request URI being matched. + } + } + ] + }, + "jobs": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "kind": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * UNSPECIFIED: Default job type, will + auto-complete to POST_DEPLOY kind. * PRE_DEPLOY: Indicates a job + that runs before an app deployment. * POST_DEPLOY: Indicates a + job that runs after an app deployment. * FAILED_DEPLOY: Indicates + a job that runs after a component fails to deploy. Known values + are: "UNSPECIFIED", "PRE_DEPLOY", "POST_DEPLOY", and + "FAILED_DEPLOY". + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "maintenance": { + "archive": bool, # Optional. Indicates whether the + app should be archived. Setting this to true implies that enabled is + set to true. Note that this feature is currently in closed beta. + "enabled": bool # Optional. Indicates whether + maintenance mode should be enabled for the app. + }, + "region": "str", # Optional. The slug form of the + geographical origin of the app. Default: ``nearest available``. Known + values are: "ams", "nyc", "fra", "sfo", "sgp", "blr", "tor", "lon", and + "syd". + "services": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "health_check": { + "failure_threshold": 0, # Optional. + The number of failed health checks before considered + unhealthy. + "http_path": "str", # Optional. The + route path used for the HTTP health check ping. If not set, + the HTTP health check will be disabled and a TCP health check + used instead. + "initial_delay_seconds": 0, # + Optional. The number of seconds to wait before beginning + health checks. + "period_seconds": 0, # Optional. The + number of seconds to wait between health checks. + "port": 0, # Optional. The port on + which the health check will be performed. If not set, the + health check will be performed on the component's http_port. + "success_threshold": 0, # Optional. + The number of successful health checks before considered + healthy. + "timeout_seconds": 0 # Optional. The + number of seconds after which the check times out. + }, + "http_port": 0, # Optional. The internal + port on which this service's run command will listen. Default: + 8080 If there is not an environment variable with the name + ``PORT``"" , one will be automatically added with its value set + to the value of this field. + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "internal_ports": [ + 0 # Optional. The ports on which + this service will listen for internal traffic. + ], + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "protocol": "str", # Optional. The protocol + which the service uses to serve traffic on the http_port. * + ``HTTP``"" : The app is serving the HTTP protocol. Default. * + ``HTTP2``"" : The app is serving the HTTP/2 protocol. Currently, + this needs to be implemented in the service by serving HTTP/2 + cleartext (h2c). Known values are: "HTTP" and "HTTP2". + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "drain_seconds": 0, # Optional. The + number of seconds to wait between selecting a container + instance for termination and issuing the TERM signal. + Selecting a container instance for termination begins an + asynchronous drain of new requests on upstream + load-balancers. (Default 15). + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "static_sites": [ + { + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "catchall_document": "str", # Optional. The + name of the document to use as the fallback for any requests to + documents that are not found when serving this static site. Only + 1 of ``catchall_document`` or ``error_document`` can be set. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "error_document": "404.html", # Optional. + Default value is "404.html". The name of the error document to + use when serving this static site. Default: 404.html. If no such + file exists within the built assets, App Platform will supply + one. + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "index_document": "index.html", # Optional. + Default value is "index.html". The name of the index document to + use when serving this static site. Default: index.html. + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "output_dir": "str", # Optional. An optional + path to where the built assets will be located, relative to the + build context. If not set, App Platform will automatically scan + for these directory names: ``_static``"" , ``dist``"" , + ``public``"" , ``build``. + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "workers": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ] + }, + "static_sites": [ + { + "name": "str", # Optional. The name of this static + site. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this static site. + } + ], + "tier_slug": "str", # Optional. The current pricing tier slug of the + deployment. + "updated_at": "2020-02-20 00:00:00", # Optional. When the deployment + was last updated. + "workers": [ + { + "name": "str", # Optional. The name of this worker. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this worker. + } + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def restart( + self, + app_id: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Restart an App. + + Perform a rolling restart of all or specific components in an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deployment": { + "cause": "str", # Optional. What caused this deployment to be + created. + "cloned_from": "str", # Optional. The ID of a previous deployment + that this deployment was cloned from. + "created_at": "2020-02-20 00:00:00", # Optional. The creation time + of the deployment. + "functions": [ + { + "name": "str", # Optional. The name of this + functions component. + "namespace": "str", # Optional. The namespace where + the functions are deployed. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this functions + component. + } + ], + "id": "str", # Optional. The ID of the deployment. + "jobs": [ + { + "name": "str", # Optional. The name of this job. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this job. + } + ], + "phase": "UNKNOWN", # Optional. Default value is "UNKNOWN". Known + values are: "UNKNOWN", "PENDING_BUILD", "BUILDING", "PENDING_DEPLOY", + "DEPLOYING", "ACTIVE", "SUPERSEDED", "ERROR", and "CANCELED". + "phase_last_updated_at": "2020-02-20 00:00:00", # Optional. When the + deployment phase was last updated. + "progress": { + "error_steps": 0, # Optional. Number of unsuccessful steps. + "pending_steps": 0, # Optional. Number of pending steps. + "running_steps": 0, # Optional. Number of currently running + steps. + "steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "success_steps": 0, # Optional. Number of successful steps. + "summary_steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "total_steps": 0 # Optional. Total number of steps. + }, + "services": [ + { + "name": "str", # Optional. The name of this service. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this service. + } + ], + "spec": { + "name": "str", # The name of the app. Must be unique across + all apps in the same account. Required. + "databases": [ + { + "name": "str", # The database's name. The + name must be unique across all components within the same app and + cannot use capital letters. Required. + "cluster_name": "str", # Optional. The name + of the underlying DigitalOcean DBaaS cluster. This is required + for production databases. For dev databases, if cluster_name is + not set, a new cluster will be provisioned. + "db_name": "str", # Optional. The name of + the MySQL or PostgreSQL database to configure. + "db_user": "str", # Optional. The name of + the MySQL or PostgreSQL user to configure. + "engine": "UNSET", # Optional. Default value + is "UNSET". * MYSQL: MySQL * PG: PostgreSQL * REDIS: Redis * + MONGODB: MongoDB * KAFKA: Kafka * OPENSEARCH: OpenSearch. Known + values are: "UNSET", "MYSQL", "PG", "REDIS", "MONGODB", "KAFKA", + and "OPENSEARCH". + "production": bool, # Optional. Whether this + is a production or dev database. + "version": "str" # Optional. The version of + the database engine. + } + ], + "domains": [ + { + "domain": "str", # The hostname for the + domain. Required. + "minimum_tls_version": "str", # Optional. + The minimum version of TLS a client application can use to access + resources for the domain. Must be one of the following values + wrapped within quotations: ``"1.2"`` or ``"1.3"``. Known values + are: "1.2" and "1.3". + "type": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * DEFAULT: The default + ``.ondigitalocean.app`` domain assigned to this app * PRIMARY: + The primary domain for this app that is displayed as the default + in the control panel, used in bindable environment variables, and + any other places that reference an app's live URL. Only one + domain may be set as primary. * ALIAS: A non-primary domain. + Known values are: "UNSPECIFIED", "DEFAULT", "PRIMARY", and + "ALIAS". + "wildcard": bool, # Optional. Indicates + whether the domain includes all sub-domains, in addition to the + given domain. + "zone": "str" # Optional. Optional. If the + domain uses DigitalOcean DNS and you would like App Platform to + automatically manage it for you, set this to the name of the + domain on your account. For example, If the domain you are + adding is ``app.domain.com``"" , the zone could be + ``domain.com``. + } + ], + "egress": { + "type": "AUTOASSIGN" # Optional. Default value is + "AUTOASSIGN". The app egress type. Known values are: "AUTOASSIGN" and + "DEDICATED_IP". + }, + "functions": [ + { + "name": "str", # The name. Must be unique + across all components within the same app. Required. + "alerts": [ + { + "disabled": bool, # + Optional. Is the alert disabled?. + "operator": + "UNSPECIFIED_OPERATOR", # Optional. Default value is + "UNSPECIFIED_OPERATOR". Known values are: + "UNSPECIFIED_OPERATOR", "GREATER_THAN", and "LESS_THAN". + "rule": "UNSPECIFIED_RULE", + # Optional. Default value is "UNSPECIFIED_RULE". Known + values are: "UNSPECIFIED_RULE", "CPU_UTILIZATION", + "MEM_UTILIZATION", "RESTART_COUNT", "DEPLOYMENT_FAILED", + "DEPLOYMENT_LIVE", "DOMAIN_FAILED", "DOMAIN_LIVE", + "FUNCTIONS_ACTIVATION_COUNT", + "FUNCTIONS_AVERAGE_DURATION_MS", + "FUNCTIONS_ERROR_RATE_PER_MINUTE", + "FUNCTIONS_AVERAGE_WAIT_TIME_MS", + "FUNCTIONS_ERROR_COUNT", and + "FUNCTIONS_GB_RATE_PER_SECOND". + "value": 0.0, # Optional. + Threshold value for alert. + "window": + "UNSPECIFIED_WINDOW" # Optional. Default value is + "UNSPECIFIED_WINDOW". Known values are: + "UNSPECIFIED_WINDOW", "FIVE_MINUTES", "TEN_MINUTES", + "THIRTY_MINUTES", and "ONE_HOUR". + } + ], + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "ingress": { + "rules": [ + { + "component": { + "name": "str", # The name of + the component to route to. Required. + "preserve_path_prefix": + "str", # Optional. An optional flag to preserve the path + that is forwarded to the backend service. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. Note: this is not applicable for + Functions Components and is mutually exclusive with + ``rewrite``. + "rewrite": "str" # Optional. + An optional field that will rewrite the path of the + component to be what is specified here. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If you specified the rewrite to be + ``/v1/``"" , requests to ``/api/list`` would be rewritten + to ``/v1/list``. Note: this is mutually exclusive with + ``preserve_path_prefix``. + }, + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to + the client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. + The set of allowed HTTP request headers. This + configures the ``Access-Control-Allow-Headers`` + header. + ], + "allow_methods": [ + "str" # Optional. + The set of allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": + "str", # Optional. Exact string match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "prefix": + "str", # Optional. Prefix-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "regex": + "str" # Optional. RE2 style regex-based match. + Only 1 of ``exact``"" , ``prefix``"" , or + ``regex`` must be set. For more information about + RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. + The set of HTTP response headers that browsers are + allowed to access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. + An optional duration specifying how long browsers can + cache the results of a preflight request. This configures + the ``Access-Control-Max-Age`` header. + }, + "match": { + "path": { + "prefix": "str" # + Prefix-based match. For example, ``/api`` will match + ``/api``"" , ``/api/``"" , and any nested paths such + as ``/api/v1/endpoint``. Required. + } + }, + "redirect": { + "authority": "str", # + Optional. The authority/host to redirect to. This can be + a hostname or IP address. Note: use ``port`` to set the + port. + "port": 0, # Optional. The + port to redirect to. + "redirect_code": 0, # + Optional. The redirect code to use. Defaults to ``302``. + Supported values are 300, 301, 302, 303, 304, 307, 308. + "scheme": "str", # Optional. + The scheme to redirect to. Supported values are ``http`` + or ``https``. Default: ``https``. + "uri": "str" # Optional. An + optional URI path to redirect to. Note: if this is + specified the whole URI of the original request will be + overwritten to this value, irrespective of the original + request URI being matched. + } + } + ] + }, + "jobs": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "kind": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * UNSPECIFIED: Default job type, will + auto-complete to POST_DEPLOY kind. * PRE_DEPLOY: Indicates a job + that runs before an app deployment. * POST_DEPLOY: Indicates a + job that runs after an app deployment. * FAILED_DEPLOY: Indicates + a job that runs after a component fails to deploy. Known values + are: "UNSPECIFIED", "PRE_DEPLOY", "POST_DEPLOY", and + "FAILED_DEPLOY". + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "maintenance": { + "archive": bool, # Optional. Indicates whether the + app should be archived. Setting this to true implies that enabled is + set to true. Note that this feature is currently in closed beta. + "enabled": bool # Optional. Indicates whether + maintenance mode should be enabled for the app. + }, + "region": "str", # Optional. The slug form of the + geographical origin of the app. Default: ``nearest available``. Known + values are: "ams", "nyc", "fra", "sfo", "sgp", "blr", "tor", "lon", and + "syd". + "services": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "health_check": { + "failure_threshold": 0, # Optional. + The number of failed health checks before considered + unhealthy. + "http_path": "str", # Optional. The + route path used for the HTTP health check ping. If not set, + the HTTP health check will be disabled and a TCP health check + used instead. + "initial_delay_seconds": 0, # + Optional. The number of seconds to wait before beginning + health checks. + "period_seconds": 0, # Optional. The + number of seconds to wait between health checks. + "port": 0, # Optional. The port on + which the health check will be performed. If not set, the + health check will be performed on the component's http_port. + "success_threshold": 0, # Optional. + The number of successful health checks before considered + healthy. + "timeout_seconds": 0 # Optional. The + number of seconds after which the check times out. + }, + "http_port": 0, # Optional. The internal + port on which this service's run command will listen. Default: + 8080 If there is not an environment variable with the name + ``PORT``"" , one will be automatically added with its value set + to the value of this field. + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "internal_ports": [ + 0 # Optional. The ports on which + this service will listen for internal traffic. + ], + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "protocol": "str", # Optional. The protocol + which the service uses to serve traffic on the http_port. * + ``HTTP``"" : The app is serving the HTTP protocol. Default. * + ``HTTP2``"" : The app is serving the HTTP/2 protocol. Currently, + this needs to be implemented in the service by serving HTTP/2 + cleartext (h2c). Known values are: "HTTP" and "HTTP2". + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "drain_seconds": 0, # Optional. The + number of seconds to wait between selecting a container + instance for termination and issuing the TERM signal. + Selecting a container instance for termination begins an + asynchronous drain of new requests on upstream + load-balancers. (Default 15). + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "static_sites": [ + { + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "catchall_document": "str", # Optional. The + name of the document to use as the fallback for any requests to + documents that are not found when serving this static site. Only + 1 of ``catchall_document`` or ``error_document`` can be set. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "error_document": "404.html", # Optional. + Default value is "404.html". The name of the error document to + use when serving this static site. Default: 404.html. If no such + file exists within the built assets, App Platform will supply + one. + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "index_document": "index.html", # Optional. + Default value is "index.html". The name of the index document to + use when serving this static site. Default: index.html. + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "output_dir": "str", # Optional. An optional + path to where the built assets will be located, relative to the + build context. If not set, App Platform will automatically scan + for these directory names: ``_static``"" , ``dist``"" , + ``public``"" , ``build``. + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "workers": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ] + }, + "static_sites": [ + { + "name": "str", # Optional. The name of this static + site. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this static site. + } + ], + "tier_slug": "str", # Optional. The current pricing tier slug of the + deployment. + "updated_at": "2020-02-20 00:00:00", # Optional. When the deployment + was last updated. + "workers": [ + { + "name": "str", # Optional. The name of this worker. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this worker. + } + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def restart( + self, app_id: str, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Restart an App. + + Perform a rolling restart of all or specific components in an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "components": [ + "str" # Optional. Optional list of components to restart. If not + provided, all components will be restarted. + ] + } + + # response body for status code(s): 200 + response == { + "deployment": { + "cause": "str", # Optional. What caused this deployment to be + created. + "cloned_from": "str", # Optional. The ID of a previous deployment + that this deployment was cloned from. + "created_at": "2020-02-20 00:00:00", # Optional. The creation time + of the deployment. + "functions": [ + { + "name": "str", # Optional. The name of this + functions component. + "namespace": "str", # Optional. The namespace where + the functions are deployed. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this functions + component. + } + ], + "id": "str", # Optional. The ID of the deployment. + "jobs": [ + { + "name": "str", # Optional. The name of this job. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this job. + } + ], + "phase": "UNKNOWN", # Optional. Default value is "UNKNOWN". Known + values are: "UNKNOWN", "PENDING_BUILD", "BUILDING", "PENDING_DEPLOY", + "DEPLOYING", "ACTIVE", "SUPERSEDED", "ERROR", and "CANCELED". + "phase_last_updated_at": "2020-02-20 00:00:00", # Optional. When the + deployment phase was last updated. + "progress": { + "error_steps": 0, # Optional. Number of unsuccessful steps. + "pending_steps": 0, # Optional. Number of pending steps. + "running_steps": 0, # Optional. Number of currently running + steps. + "steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "success_steps": 0, # Optional. Number of successful steps. + "summary_steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "total_steps": 0 # Optional. Total number of steps. + }, + "services": [ + { + "name": "str", # Optional. The name of this service. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this service. + } + ], + "spec": { + "name": "str", # The name of the app. Must be unique across + all apps in the same account. Required. + "databases": [ + { + "name": "str", # The database's name. The + name must be unique across all components within the same app and + cannot use capital letters. Required. + "cluster_name": "str", # Optional. The name + of the underlying DigitalOcean DBaaS cluster. This is required + for production databases. For dev databases, if cluster_name is + not set, a new cluster will be provisioned. + "db_name": "str", # Optional. The name of + the MySQL or PostgreSQL database to configure. + "db_user": "str", # Optional. The name of + the MySQL or PostgreSQL user to configure. + "engine": "UNSET", # Optional. Default value + is "UNSET". * MYSQL: MySQL * PG: PostgreSQL * REDIS: Redis * + MONGODB: MongoDB * KAFKA: Kafka * OPENSEARCH: OpenSearch. Known + values are: "UNSET", "MYSQL", "PG", "REDIS", "MONGODB", "KAFKA", + and "OPENSEARCH". + "production": bool, # Optional. Whether this + is a production or dev database. + "version": "str" # Optional. The version of + the database engine. + } + ], + "domains": [ + { + "domain": "str", # The hostname for the + domain. Required. + "minimum_tls_version": "str", # Optional. + The minimum version of TLS a client application can use to access + resources for the domain. Must be one of the following values + wrapped within quotations: ``"1.2"`` or ``"1.3"``. Known values + are: "1.2" and "1.3". + "type": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * DEFAULT: The default + ``.ondigitalocean.app`` domain assigned to this app * PRIMARY: + The primary domain for this app that is displayed as the default + in the control panel, used in bindable environment variables, and + any other places that reference an app's live URL. Only one + domain may be set as primary. * ALIAS: A non-primary domain. + Known values are: "UNSPECIFIED", "DEFAULT", "PRIMARY", and + "ALIAS". + "wildcard": bool, # Optional. Indicates + whether the domain includes all sub-domains, in addition to the + given domain. + "zone": "str" # Optional. Optional. If the + domain uses DigitalOcean DNS and you would like App Platform to + automatically manage it for you, set this to the name of the + domain on your account. For example, If the domain you are + adding is ``app.domain.com``"" , the zone could be + ``domain.com``. + } + ], + "egress": { + "type": "AUTOASSIGN" # Optional. Default value is + "AUTOASSIGN". The app egress type. Known values are: "AUTOASSIGN" and + "DEDICATED_IP". + }, + "functions": [ + { + "name": "str", # The name. Must be unique + across all components within the same app. Required. + "alerts": [ + { + "disabled": bool, # + Optional. Is the alert disabled?. + "operator": + "UNSPECIFIED_OPERATOR", # Optional. Default value is + "UNSPECIFIED_OPERATOR". Known values are: + "UNSPECIFIED_OPERATOR", "GREATER_THAN", and "LESS_THAN". + "rule": "UNSPECIFIED_RULE", + # Optional. Default value is "UNSPECIFIED_RULE". Known + values are: "UNSPECIFIED_RULE", "CPU_UTILIZATION", + "MEM_UTILIZATION", "RESTART_COUNT", "DEPLOYMENT_FAILED", + "DEPLOYMENT_LIVE", "DOMAIN_FAILED", "DOMAIN_LIVE", + "FUNCTIONS_ACTIVATION_COUNT", + "FUNCTIONS_AVERAGE_DURATION_MS", + "FUNCTIONS_ERROR_RATE_PER_MINUTE", + "FUNCTIONS_AVERAGE_WAIT_TIME_MS", + "FUNCTIONS_ERROR_COUNT", and + "FUNCTIONS_GB_RATE_PER_SECOND". + "value": 0.0, # Optional. + Threshold value for alert. + "window": + "UNSPECIFIED_WINDOW" # Optional. Default value is + "UNSPECIFIED_WINDOW". Known values are: + "UNSPECIFIED_WINDOW", "FIVE_MINUTES", "TEN_MINUTES", + "THIRTY_MINUTES", and "ONE_HOUR". + } + ], + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "ingress": { + "rules": [ + { + "component": { + "name": "str", # The name of + the component to route to. Required. + "preserve_path_prefix": + "str", # Optional. An optional flag to preserve the path + that is forwarded to the backend service. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. Note: this is not applicable for + Functions Components and is mutually exclusive with + ``rewrite``. + "rewrite": "str" # Optional. + An optional field that will rewrite the path of the + component to be what is specified here. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If you specified the rewrite to be + ``/v1/``"" , requests to ``/api/list`` would be rewritten + to ``/v1/list``. Note: this is mutually exclusive with + ``preserve_path_prefix``. + }, + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to + the client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. + The set of allowed HTTP request headers. This + configures the ``Access-Control-Allow-Headers`` + header. + ], + "allow_methods": [ + "str" # Optional. + The set of allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": + "str", # Optional. Exact string match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "prefix": + "str", # Optional. Prefix-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "regex": + "str" # Optional. RE2 style regex-based match. + Only 1 of ``exact``"" , ``prefix``"" , or + ``regex`` must be set. For more information about + RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. + The set of HTTP response headers that browsers are + allowed to access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. + An optional duration specifying how long browsers can + cache the results of a preflight request. This configures + the ``Access-Control-Max-Age`` header. + }, + "match": { + "path": { + "prefix": "str" # + Prefix-based match. For example, ``/api`` will match + ``/api``"" , ``/api/``"" , and any nested paths such + as ``/api/v1/endpoint``. Required. + } + }, + "redirect": { + "authority": "str", # + Optional. The authority/host to redirect to. This can be + a hostname or IP address. Note: use ``port`` to set the + port. + "port": 0, # Optional. The + port to redirect to. + "redirect_code": 0, # + Optional. The redirect code to use. Defaults to ``302``. + Supported values are 300, 301, 302, 303, 304, 307, 308. + "scheme": "str", # Optional. + The scheme to redirect to. Supported values are ``http`` + or ``https``. Default: ``https``. + "uri": "str" # Optional. An + optional URI path to redirect to. Note: if this is + specified the whole URI of the original request will be + overwritten to this value, irrespective of the original + request URI being matched. + } + } + ] + }, + "jobs": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "kind": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * UNSPECIFIED: Default job type, will + auto-complete to POST_DEPLOY kind. * PRE_DEPLOY: Indicates a job + that runs before an app deployment. * POST_DEPLOY: Indicates a + job that runs after an app deployment. * FAILED_DEPLOY: Indicates + a job that runs after a component fails to deploy. Known values + are: "UNSPECIFIED", "PRE_DEPLOY", "POST_DEPLOY", and + "FAILED_DEPLOY". + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "maintenance": { + "archive": bool, # Optional. Indicates whether the + app should be archived. Setting this to true implies that enabled is + set to true. Note that this feature is currently in closed beta. + "enabled": bool # Optional. Indicates whether + maintenance mode should be enabled for the app. + }, + "region": "str", # Optional. The slug form of the + geographical origin of the app. Default: ``nearest available``. Known + values are: "ams", "nyc", "fra", "sfo", "sgp", "blr", "tor", "lon", and + "syd". + "services": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "health_check": { + "failure_threshold": 0, # Optional. + The number of failed health checks before considered + unhealthy. + "http_path": "str", # Optional. The + route path used for the HTTP health check ping. If not set, + the HTTP health check will be disabled and a TCP health check + used instead. + "initial_delay_seconds": 0, # + Optional. The number of seconds to wait before beginning + health checks. + "period_seconds": 0, # Optional. The + number of seconds to wait between health checks. + "port": 0, # Optional. The port on + which the health check will be performed. If not set, the + health check will be performed on the component's http_port. + "success_threshold": 0, # Optional. + The number of successful health checks before considered + healthy. + "timeout_seconds": 0 # Optional. The + number of seconds after which the check times out. + }, + "http_port": 0, # Optional. The internal + port on which this service's run command will listen. Default: + 8080 If there is not an environment variable with the name + ``PORT``"" , one will be automatically added with its value set + to the value of this field. + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "internal_ports": [ + 0 # Optional. The ports on which + this service will listen for internal traffic. + ], + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "protocol": "str", # Optional. The protocol + which the service uses to serve traffic on the http_port. * + ``HTTP``"" : The app is serving the HTTP protocol. Default. * + ``HTTP2``"" : The app is serving the HTTP/2 protocol. Currently, + this needs to be implemented in the service by serving HTTP/2 + cleartext (h2c). Known values are: "HTTP" and "HTTP2". + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "drain_seconds": 0, # Optional. The + number of seconds to wait between selecting a container + instance for termination and issuing the TERM signal. + Selecting a container instance for termination begins an + asynchronous drain of new requests on upstream + load-balancers. (Default 15). + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "static_sites": [ + { + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "catchall_document": "str", # Optional. The + name of the document to use as the fallback for any requests to + documents that are not found when serving this static site. Only + 1 of ``catchall_document`` or ``error_document`` can be set. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "error_document": "404.html", # Optional. + Default value is "404.html". The name of the error document to + use when serving this static site. Default: 404.html. If no such + file exists within the built assets, App Platform will supply + one. + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "index_document": "index.html", # Optional. + Default value is "index.html". The name of the index document to + use when serving this static site. Default: index.html. + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "output_dir": "str", # Optional. An optional + path to where the built assets will be located, relative to the + build context. If not set, App Platform will automatically scan + for these directory names: ``_static``"" , ``dist``"" , + ``public``"" , ``build``. + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "workers": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ] + }, + "static_sites": [ + { + "name": "str", # Optional. The name of this static + site. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this static site. + } + ], + "tier_slug": "str", # Optional. The current pricing tier slug of the + deployment. + "updated_at": "2020-02-20 00:00:00", # Optional. When the deployment + was last updated. + "workers": [ + { + "name": "str", # Optional. The name of this worker. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this worker. + } + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = body + else: + _json = None + + _request = build_apps_restart_request( + app_id=app_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + @distributed_trace_async async def get_logs_active_deployment( self, diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index 3e841de..ef3b53b 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -407,6 +407,32 @@ def build_apps_update_request(id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) +def build_apps_restart_request(app_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/apps/{app_id}/restart" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + def build_apps_get_logs_active_deployment_request( # pylint: disable=name-too-long app_id: str, component_name: str, @@ -71684,6 +71710,4248 @@ def update(self, id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore + @overload + def restart( + self, + app_id: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Restart an App. + + Perform a rolling restart of all or specific components in an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "components": [ + "str" # Optional. Optional list of components to restart. If not + provided, all components will be restarted. + ] + } + + # response body for status code(s): 200 + response == { + "deployment": { + "cause": "str", # Optional. What caused this deployment to be + created. + "cloned_from": "str", # Optional. The ID of a previous deployment + that this deployment was cloned from. + "created_at": "2020-02-20 00:00:00", # Optional. The creation time + of the deployment. + "functions": [ + { + "name": "str", # Optional. The name of this + functions component. + "namespace": "str", # Optional. The namespace where + the functions are deployed. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this functions + component. + } + ], + "id": "str", # Optional. The ID of the deployment. + "jobs": [ + { + "name": "str", # Optional. The name of this job. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this job. + } + ], + "phase": "UNKNOWN", # Optional. Default value is "UNKNOWN". Known + values are: "UNKNOWN", "PENDING_BUILD", "BUILDING", "PENDING_DEPLOY", + "DEPLOYING", "ACTIVE", "SUPERSEDED", "ERROR", and "CANCELED". + "phase_last_updated_at": "2020-02-20 00:00:00", # Optional. When the + deployment phase was last updated. + "progress": { + "error_steps": 0, # Optional. Number of unsuccessful steps. + "pending_steps": 0, # Optional. Number of pending steps. + "running_steps": 0, # Optional. Number of currently running + steps. + "steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "success_steps": 0, # Optional. Number of successful steps. + "summary_steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "total_steps": 0 # Optional. Total number of steps. + }, + "services": [ + { + "name": "str", # Optional. The name of this service. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this service. + } + ], + "spec": { + "name": "str", # The name of the app. Must be unique across + all apps in the same account. Required. + "databases": [ + { + "name": "str", # The database's name. The + name must be unique across all components within the same app and + cannot use capital letters. Required. + "cluster_name": "str", # Optional. The name + of the underlying DigitalOcean DBaaS cluster. This is required + for production databases. For dev databases, if cluster_name is + not set, a new cluster will be provisioned. + "db_name": "str", # Optional. The name of + the MySQL or PostgreSQL database to configure. + "db_user": "str", # Optional. The name of + the MySQL or PostgreSQL user to configure. + "engine": "UNSET", # Optional. Default value + is "UNSET". * MYSQL: MySQL * PG: PostgreSQL * REDIS: Redis * + MONGODB: MongoDB * KAFKA: Kafka * OPENSEARCH: OpenSearch. Known + values are: "UNSET", "MYSQL", "PG", "REDIS", "MONGODB", "KAFKA", + and "OPENSEARCH". + "production": bool, # Optional. Whether this + is a production or dev database. + "version": "str" # Optional. The version of + the database engine. + } + ], + "domains": [ + { + "domain": "str", # The hostname for the + domain. Required. + "minimum_tls_version": "str", # Optional. + The minimum version of TLS a client application can use to access + resources for the domain. Must be one of the following values + wrapped within quotations: ``"1.2"`` or ``"1.3"``. Known values + are: "1.2" and "1.3". + "type": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * DEFAULT: The default + ``.ondigitalocean.app`` domain assigned to this app * PRIMARY: + The primary domain for this app that is displayed as the default + in the control panel, used in bindable environment variables, and + any other places that reference an app's live URL. Only one + domain may be set as primary. * ALIAS: A non-primary domain. + Known values are: "UNSPECIFIED", "DEFAULT", "PRIMARY", and + "ALIAS". + "wildcard": bool, # Optional. Indicates + whether the domain includes all sub-domains, in addition to the + given domain. + "zone": "str" # Optional. Optional. If the + domain uses DigitalOcean DNS and you would like App Platform to + automatically manage it for you, set this to the name of the + domain on your account. For example, If the domain you are + adding is ``app.domain.com``"" , the zone could be + ``domain.com``. + } + ], + "egress": { + "type": "AUTOASSIGN" # Optional. Default value is + "AUTOASSIGN". The app egress type. Known values are: "AUTOASSIGN" and + "DEDICATED_IP". + }, + "functions": [ + { + "name": "str", # The name. Must be unique + across all components within the same app. Required. + "alerts": [ + { + "disabled": bool, # + Optional. Is the alert disabled?. + "operator": + "UNSPECIFIED_OPERATOR", # Optional. Default value is + "UNSPECIFIED_OPERATOR". Known values are: + "UNSPECIFIED_OPERATOR", "GREATER_THAN", and "LESS_THAN". + "rule": "UNSPECIFIED_RULE", + # Optional. Default value is "UNSPECIFIED_RULE". Known + values are: "UNSPECIFIED_RULE", "CPU_UTILIZATION", + "MEM_UTILIZATION", "RESTART_COUNT", "DEPLOYMENT_FAILED", + "DEPLOYMENT_LIVE", "DOMAIN_FAILED", "DOMAIN_LIVE", + "FUNCTIONS_ACTIVATION_COUNT", + "FUNCTIONS_AVERAGE_DURATION_MS", + "FUNCTIONS_ERROR_RATE_PER_MINUTE", + "FUNCTIONS_AVERAGE_WAIT_TIME_MS", + "FUNCTIONS_ERROR_COUNT", and + "FUNCTIONS_GB_RATE_PER_SECOND". + "value": 0.0, # Optional. + Threshold value for alert. + "window": + "UNSPECIFIED_WINDOW" # Optional. Default value is + "UNSPECIFIED_WINDOW". Known values are: + "UNSPECIFIED_WINDOW", "FIVE_MINUTES", "TEN_MINUTES", + "THIRTY_MINUTES", and "ONE_HOUR". + } + ], + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "ingress": { + "rules": [ + { + "component": { + "name": "str", # The name of + the component to route to. Required. + "preserve_path_prefix": + "str", # Optional. An optional flag to preserve the path + that is forwarded to the backend service. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. Note: this is not applicable for + Functions Components and is mutually exclusive with + ``rewrite``. + "rewrite": "str" # Optional. + An optional field that will rewrite the path of the + component to be what is specified here. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If you specified the rewrite to be + ``/v1/``"" , requests to ``/api/list`` would be rewritten + to ``/v1/list``. Note: this is mutually exclusive with + ``preserve_path_prefix``. + }, + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to + the client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. + The set of allowed HTTP request headers. This + configures the ``Access-Control-Allow-Headers`` + header. + ], + "allow_methods": [ + "str" # Optional. + The set of allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": + "str", # Optional. Exact string match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "prefix": + "str", # Optional. Prefix-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "regex": + "str" # Optional. RE2 style regex-based match. + Only 1 of ``exact``"" , ``prefix``"" , or + ``regex`` must be set. For more information about + RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. + The set of HTTP response headers that browsers are + allowed to access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. + An optional duration specifying how long browsers can + cache the results of a preflight request. This configures + the ``Access-Control-Max-Age`` header. + }, + "match": { + "path": { + "prefix": "str" # + Prefix-based match. For example, ``/api`` will match + ``/api``"" , ``/api/``"" , and any nested paths such + as ``/api/v1/endpoint``. Required. + } + }, + "redirect": { + "authority": "str", # + Optional. The authority/host to redirect to. This can be + a hostname or IP address. Note: use ``port`` to set the + port. + "port": 0, # Optional. The + port to redirect to. + "redirect_code": 0, # + Optional. The redirect code to use. Defaults to ``302``. + Supported values are 300, 301, 302, 303, 304, 307, 308. + "scheme": "str", # Optional. + The scheme to redirect to. Supported values are ``http`` + or ``https``. Default: ``https``. + "uri": "str" # Optional. An + optional URI path to redirect to. Note: if this is + specified the whole URI of the original request will be + overwritten to this value, irrespective of the original + request URI being matched. + } + } + ] + }, + "jobs": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "kind": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * UNSPECIFIED: Default job type, will + auto-complete to POST_DEPLOY kind. * PRE_DEPLOY: Indicates a job + that runs before an app deployment. * POST_DEPLOY: Indicates a + job that runs after an app deployment. * FAILED_DEPLOY: Indicates + a job that runs after a component fails to deploy. Known values + are: "UNSPECIFIED", "PRE_DEPLOY", "POST_DEPLOY", and + "FAILED_DEPLOY". + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "maintenance": { + "archive": bool, # Optional. Indicates whether the + app should be archived. Setting this to true implies that enabled is + set to true. Note that this feature is currently in closed beta. + "enabled": bool # Optional. Indicates whether + maintenance mode should be enabled for the app. + }, + "region": "str", # Optional. The slug form of the + geographical origin of the app. Default: ``nearest available``. Known + values are: "ams", "nyc", "fra", "sfo", "sgp", "blr", "tor", "lon", and + "syd". + "services": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "health_check": { + "failure_threshold": 0, # Optional. + The number of failed health checks before considered + unhealthy. + "http_path": "str", # Optional. The + route path used for the HTTP health check ping. If not set, + the HTTP health check will be disabled and a TCP health check + used instead. + "initial_delay_seconds": 0, # + Optional. The number of seconds to wait before beginning + health checks. + "period_seconds": 0, # Optional. The + number of seconds to wait between health checks. + "port": 0, # Optional. The port on + which the health check will be performed. If not set, the + health check will be performed on the component's http_port. + "success_threshold": 0, # Optional. + The number of successful health checks before considered + healthy. + "timeout_seconds": 0 # Optional. The + number of seconds after which the check times out. + }, + "http_port": 0, # Optional. The internal + port on which this service's run command will listen. Default: + 8080 If there is not an environment variable with the name + ``PORT``"" , one will be automatically added with its value set + to the value of this field. + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "internal_ports": [ + 0 # Optional. The ports on which + this service will listen for internal traffic. + ], + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "protocol": "str", # Optional. The protocol + which the service uses to serve traffic on the http_port. * + ``HTTP``"" : The app is serving the HTTP protocol. Default. * + ``HTTP2``"" : The app is serving the HTTP/2 protocol. Currently, + this needs to be implemented in the service by serving HTTP/2 + cleartext (h2c). Known values are: "HTTP" and "HTTP2". + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "drain_seconds": 0, # Optional. The + number of seconds to wait between selecting a container + instance for termination and issuing the TERM signal. + Selecting a container instance for termination begins an + asynchronous drain of new requests on upstream + load-balancers. (Default 15). + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "static_sites": [ + { + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "catchall_document": "str", # Optional. The + name of the document to use as the fallback for any requests to + documents that are not found when serving this static site. Only + 1 of ``catchall_document`` or ``error_document`` can be set. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "error_document": "404.html", # Optional. + Default value is "404.html". The name of the error document to + use when serving this static site. Default: 404.html. If no such + file exists within the built assets, App Platform will supply + one. + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "index_document": "index.html", # Optional. + Default value is "index.html". The name of the index document to + use when serving this static site. Default: index.html. + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "output_dir": "str", # Optional. An optional + path to where the built assets will be located, relative to the + build context. If not set, App Platform will automatically scan + for these directory names: ``_static``"" , ``dist``"" , + ``public``"" , ``build``. + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "workers": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ] + }, + "static_sites": [ + { + "name": "str", # Optional. The name of this static + site. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this static site. + } + ], + "tier_slug": "str", # Optional. The current pricing tier slug of the + deployment. + "updated_at": "2020-02-20 00:00:00", # Optional. When the deployment + was last updated. + "workers": [ + { + "name": "str", # Optional. The name of this worker. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this worker. + } + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def restart( + self, + app_id: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Restart an App. + + Perform a rolling restart of all or specific components in an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deployment": { + "cause": "str", # Optional. What caused this deployment to be + created. + "cloned_from": "str", # Optional. The ID of a previous deployment + that this deployment was cloned from. + "created_at": "2020-02-20 00:00:00", # Optional. The creation time + of the deployment. + "functions": [ + { + "name": "str", # Optional. The name of this + functions component. + "namespace": "str", # Optional. The namespace where + the functions are deployed. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this functions + component. + } + ], + "id": "str", # Optional. The ID of the deployment. + "jobs": [ + { + "name": "str", # Optional. The name of this job. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this job. + } + ], + "phase": "UNKNOWN", # Optional. Default value is "UNKNOWN". Known + values are: "UNKNOWN", "PENDING_BUILD", "BUILDING", "PENDING_DEPLOY", + "DEPLOYING", "ACTIVE", "SUPERSEDED", "ERROR", and "CANCELED". + "phase_last_updated_at": "2020-02-20 00:00:00", # Optional. When the + deployment phase was last updated. + "progress": { + "error_steps": 0, # Optional. Number of unsuccessful steps. + "pending_steps": 0, # Optional. Number of pending steps. + "running_steps": 0, # Optional. Number of currently running + steps. + "steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "success_steps": 0, # Optional. Number of successful steps. + "summary_steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "total_steps": 0 # Optional. Total number of steps. + }, + "services": [ + { + "name": "str", # Optional. The name of this service. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this service. + } + ], + "spec": { + "name": "str", # The name of the app. Must be unique across + all apps in the same account. Required. + "databases": [ + { + "name": "str", # The database's name. The + name must be unique across all components within the same app and + cannot use capital letters. Required. + "cluster_name": "str", # Optional. The name + of the underlying DigitalOcean DBaaS cluster. This is required + for production databases. For dev databases, if cluster_name is + not set, a new cluster will be provisioned. + "db_name": "str", # Optional. The name of + the MySQL or PostgreSQL database to configure. + "db_user": "str", # Optional. The name of + the MySQL or PostgreSQL user to configure. + "engine": "UNSET", # Optional. Default value + is "UNSET". * MYSQL: MySQL * PG: PostgreSQL * REDIS: Redis * + MONGODB: MongoDB * KAFKA: Kafka * OPENSEARCH: OpenSearch. Known + values are: "UNSET", "MYSQL", "PG", "REDIS", "MONGODB", "KAFKA", + and "OPENSEARCH". + "production": bool, # Optional. Whether this + is a production or dev database. + "version": "str" # Optional. The version of + the database engine. + } + ], + "domains": [ + { + "domain": "str", # The hostname for the + domain. Required. + "minimum_tls_version": "str", # Optional. + The minimum version of TLS a client application can use to access + resources for the domain. Must be one of the following values + wrapped within quotations: ``"1.2"`` or ``"1.3"``. Known values + are: "1.2" and "1.3". + "type": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * DEFAULT: The default + ``.ondigitalocean.app`` domain assigned to this app * PRIMARY: + The primary domain for this app that is displayed as the default + in the control panel, used in bindable environment variables, and + any other places that reference an app's live URL. Only one + domain may be set as primary. * ALIAS: A non-primary domain. + Known values are: "UNSPECIFIED", "DEFAULT", "PRIMARY", and + "ALIAS". + "wildcard": bool, # Optional. Indicates + whether the domain includes all sub-domains, in addition to the + given domain. + "zone": "str" # Optional. Optional. If the + domain uses DigitalOcean DNS and you would like App Platform to + automatically manage it for you, set this to the name of the + domain on your account. For example, If the domain you are + adding is ``app.domain.com``"" , the zone could be + ``domain.com``. + } + ], + "egress": { + "type": "AUTOASSIGN" # Optional. Default value is + "AUTOASSIGN". The app egress type. Known values are: "AUTOASSIGN" and + "DEDICATED_IP". + }, + "functions": [ + { + "name": "str", # The name. Must be unique + across all components within the same app. Required. + "alerts": [ + { + "disabled": bool, # + Optional. Is the alert disabled?. + "operator": + "UNSPECIFIED_OPERATOR", # Optional. Default value is + "UNSPECIFIED_OPERATOR". Known values are: + "UNSPECIFIED_OPERATOR", "GREATER_THAN", and "LESS_THAN". + "rule": "UNSPECIFIED_RULE", + # Optional. Default value is "UNSPECIFIED_RULE". Known + values are: "UNSPECIFIED_RULE", "CPU_UTILIZATION", + "MEM_UTILIZATION", "RESTART_COUNT", "DEPLOYMENT_FAILED", + "DEPLOYMENT_LIVE", "DOMAIN_FAILED", "DOMAIN_LIVE", + "FUNCTIONS_ACTIVATION_COUNT", + "FUNCTIONS_AVERAGE_DURATION_MS", + "FUNCTIONS_ERROR_RATE_PER_MINUTE", + "FUNCTIONS_AVERAGE_WAIT_TIME_MS", + "FUNCTIONS_ERROR_COUNT", and + "FUNCTIONS_GB_RATE_PER_SECOND". + "value": 0.0, # Optional. + Threshold value for alert. + "window": + "UNSPECIFIED_WINDOW" # Optional. Default value is + "UNSPECIFIED_WINDOW". Known values are: + "UNSPECIFIED_WINDOW", "FIVE_MINUTES", "TEN_MINUTES", + "THIRTY_MINUTES", and "ONE_HOUR". + } + ], + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "ingress": { + "rules": [ + { + "component": { + "name": "str", # The name of + the component to route to. Required. + "preserve_path_prefix": + "str", # Optional. An optional flag to preserve the path + that is forwarded to the backend service. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. Note: this is not applicable for + Functions Components and is mutually exclusive with + ``rewrite``. + "rewrite": "str" # Optional. + An optional field that will rewrite the path of the + component to be what is specified here. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If you specified the rewrite to be + ``/v1/``"" , requests to ``/api/list`` would be rewritten + to ``/v1/list``. Note: this is mutually exclusive with + ``preserve_path_prefix``. + }, + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to + the client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. + The set of allowed HTTP request headers. This + configures the ``Access-Control-Allow-Headers`` + header. + ], + "allow_methods": [ + "str" # Optional. + The set of allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": + "str", # Optional. Exact string match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "prefix": + "str", # Optional. Prefix-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "regex": + "str" # Optional. RE2 style regex-based match. + Only 1 of ``exact``"" , ``prefix``"" , or + ``regex`` must be set. For more information about + RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. + The set of HTTP response headers that browsers are + allowed to access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. + An optional duration specifying how long browsers can + cache the results of a preflight request. This configures + the ``Access-Control-Max-Age`` header. + }, + "match": { + "path": { + "prefix": "str" # + Prefix-based match. For example, ``/api`` will match + ``/api``"" , ``/api/``"" , and any nested paths such + as ``/api/v1/endpoint``. Required. + } + }, + "redirect": { + "authority": "str", # + Optional. The authority/host to redirect to. This can be + a hostname or IP address. Note: use ``port`` to set the + port. + "port": 0, # Optional. The + port to redirect to. + "redirect_code": 0, # + Optional. The redirect code to use. Defaults to ``302``. + Supported values are 300, 301, 302, 303, 304, 307, 308. + "scheme": "str", # Optional. + The scheme to redirect to. Supported values are ``http`` + or ``https``. Default: ``https``. + "uri": "str" # Optional. An + optional URI path to redirect to. Note: if this is + specified the whole URI of the original request will be + overwritten to this value, irrespective of the original + request URI being matched. + } + } + ] + }, + "jobs": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "kind": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * UNSPECIFIED: Default job type, will + auto-complete to POST_DEPLOY kind. * PRE_DEPLOY: Indicates a job + that runs before an app deployment. * POST_DEPLOY: Indicates a + job that runs after an app deployment. * FAILED_DEPLOY: Indicates + a job that runs after a component fails to deploy. Known values + are: "UNSPECIFIED", "PRE_DEPLOY", "POST_DEPLOY", and + "FAILED_DEPLOY". + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "maintenance": { + "archive": bool, # Optional. Indicates whether the + app should be archived. Setting this to true implies that enabled is + set to true. Note that this feature is currently in closed beta. + "enabled": bool # Optional. Indicates whether + maintenance mode should be enabled for the app. + }, + "region": "str", # Optional. The slug form of the + geographical origin of the app. Default: ``nearest available``. Known + values are: "ams", "nyc", "fra", "sfo", "sgp", "blr", "tor", "lon", and + "syd". + "services": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "health_check": { + "failure_threshold": 0, # Optional. + The number of failed health checks before considered + unhealthy. + "http_path": "str", # Optional. The + route path used for the HTTP health check ping. If not set, + the HTTP health check will be disabled and a TCP health check + used instead. + "initial_delay_seconds": 0, # + Optional. The number of seconds to wait before beginning + health checks. + "period_seconds": 0, # Optional. The + number of seconds to wait between health checks. + "port": 0, # Optional. The port on + which the health check will be performed. If not set, the + health check will be performed on the component's http_port. + "success_threshold": 0, # Optional. + The number of successful health checks before considered + healthy. + "timeout_seconds": 0 # Optional. The + number of seconds after which the check times out. + }, + "http_port": 0, # Optional. The internal + port on which this service's run command will listen. Default: + 8080 If there is not an environment variable with the name + ``PORT``"" , one will be automatically added with its value set + to the value of this field. + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "internal_ports": [ + 0 # Optional. The ports on which + this service will listen for internal traffic. + ], + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "protocol": "str", # Optional. The protocol + which the service uses to serve traffic on the http_port. * + ``HTTP``"" : The app is serving the HTTP protocol. Default. * + ``HTTP2``"" : The app is serving the HTTP/2 protocol. Currently, + this needs to be implemented in the service by serving HTTP/2 + cleartext (h2c). Known values are: "HTTP" and "HTTP2". + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "drain_seconds": 0, # Optional. The + number of seconds to wait between selecting a container + instance for termination and issuing the TERM signal. + Selecting a container instance for termination begins an + asynchronous drain of new requests on upstream + load-balancers. (Default 15). + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "static_sites": [ + { + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "catchall_document": "str", # Optional. The + name of the document to use as the fallback for any requests to + documents that are not found when serving this static site. Only + 1 of ``catchall_document`` or ``error_document`` can be set. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "error_document": "404.html", # Optional. + Default value is "404.html". The name of the error document to + use when serving this static site. Default: 404.html. If no such + file exists within the built assets, App Platform will supply + one. + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "index_document": "index.html", # Optional. + Default value is "index.html". The name of the index document to + use when serving this static site. Default: index.html. + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "output_dir": "str", # Optional. An optional + path to where the built assets will be located, relative to the + build context. If not set, App Platform will automatically scan + for these directory names: ``_static``"" , ``dist``"" , + ``public``"" , ``build``. + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "workers": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ] + }, + "static_sites": [ + { + "name": "str", # Optional. The name of this static + site. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this static site. + } + ], + "tier_slug": "str", # Optional. The current pricing tier slug of the + deployment. + "updated_at": "2020-02-20 00:00:00", # Optional. When the deployment + was last updated. + "workers": [ + { + "name": "str", # Optional. The name of this worker. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this worker. + } + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def restart( + self, app_id: str, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Restart an App. + + Perform a rolling restart of all or specific components in an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "components": [ + "str" # Optional. Optional list of components to restart. If not + provided, all components will be restarted. + ] + } + + # response body for status code(s): 200 + response == { + "deployment": { + "cause": "str", # Optional. What caused this deployment to be + created. + "cloned_from": "str", # Optional. The ID of a previous deployment + that this deployment was cloned from. + "created_at": "2020-02-20 00:00:00", # Optional. The creation time + of the deployment. + "functions": [ + { + "name": "str", # Optional. The name of this + functions component. + "namespace": "str", # Optional. The namespace where + the functions are deployed. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this functions + component. + } + ], + "id": "str", # Optional. The ID of the deployment. + "jobs": [ + { + "name": "str", # Optional. The name of this job. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this job. + } + ], + "phase": "UNKNOWN", # Optional. Default value is "UNKNOWN". Known + values are: "UNKNOWN", "PENDING_BUILD", "BUILDING", "PENDING_DEPLOY", + "DEPLOYING", "ACTIVE", "SUPERSEDED", "ERROR", and "CANCELED". + "phase_last_updated_at": "2020-02-20 00:00:00", # Optional. When the + deployment phase was last updated. + "progress": { + "error_steps": 0, # Optional. Number of unsuccessful steps. + "pending_steps": 0, # Optional. Number of pending steps. + "running_steps": 0, # Optional. Number of currently running + steps. + "steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "success_steps": 0, # Optional. Number of successful steps. + "summary_steps": [ + { + "component_name": "str", # Optional. The + component name that this step is associated with. + "ended_at": "2020-02-20 00:00:00", # + Optional. The end time of this step. + "message_base": "str", # Optional. The base + of a human-readable description of the step intended to be + combined with the component name for presentation. For example: + ``message_base`` = "Building service" ``component_name`` = "api". + "name": "str", # Optional. The name of this + step. + "reason": { + "code": "str", # Optional. The error + code. + "message": "str" # Optional. The + error message. + }, + "started_at": "2020-02-20 00:00:00", # + Optional. The start time of this step. + "status": "UNKNOWN", # Optional. Default + value is "UNKNOWN". Known values are: "UNKNOWN", "PENDING", + "RUNNING", "ERROR", and "SUCCESS". + "steps": [ + {} # Optional. Child steps of this + step. + ] + } + ], + "total_steps": 0 # Optional. Total number of steps. + }, + "services": [ + { + "name": "str", # Optional. The name of this service. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this service. + } + ], + "spec": { + "name": "str", # The name of the app. Must be unique across + all apps in the same account. Required. + "databases": [ + { + "name": "str", # The database's name. The + name must be unique across all components within the same app and + cannot use capital letters. Required. + "cluster_name": "str", # Optional. The name + of the underlying DigitalOcean DBaaS cluster. This is required + for production databases. For dev databases, if cluster_name is + not set, a new cluster will be provisioned. + "db_name": "str", # Optional. The name of + the MySQL or PostgreSQL database to configure. + "db_user": "str", # Optional. The name of + the MySQL or PostgreSQL user to configure. + "engine": "UNSET", # Optional. Default value + is "UNSET". * MYSQL: MySQL * PG: PostgreSQL * REDIS: Redis * + MONGODB: MongoDB * KAFKA: Kafka * OPENSEARCH: OpenSearch. Known + values are: "UNSET", "MYSQL", "PG", "REDIS", "MONGODB", "KAFKA", + and "OPENSEARCH". + "production": bool, # Optional. Whether this + is a production or dev database. + "version": "str" # Optional. The version of + the database engine. + } + ], + "domains": [ + { + "domain": "str", # The hostname for the + domain. Required. + "minimum_tls_version": "str", # Optional. + The minimum version of TLS a client application can use to access + resources for the domain. Must be one of the following values + wrapped within quotations: ``"1.2"`` or ``"1.3"``. Known values + are: "1.2" and "1.3". + "type": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * DEFAULT: The default + ``.ondigitalocean.app`` domain assigned to this app * PRIMARY: + The primary domain for this app that is displayed as the default + in the control panel, used in bindable environment variables, and + any other places that reference an app's live URL. Only one + domain may be set as primary. * ALIAS: A non-primary domain. + Known values are: "UNSPECIFIED", "DEFAULT", "PRIMARY", and + "ALIAS". + "wildcard": bool, # Optional. Indicates + whether the domain includes all sub-domains, in addition to the + given domain. + "zone": "str" # Optional. Optional. If the + domain uses DigitalOcean DNS and you would like App Platform to + automatically manage it for you, set this to the name of the + domain on your account. For example, If the domain you are + adding is ``app.domain.com``"" , the zone could be + ``domain.com``. + } + ], + "egress": { + "type": "AUTOASSIGN" # Optional. Default value is + "AUTOASSIGN". The app egress type. Known values are: "AUTOASSIGN" and + "DEDICATED_IP". + }, + "functions": [ + { + "name": "str", # The name. Must be unique + across all components within the same app. Required. + "alerts": [ + { + "disabled": bool, # + Optional. Is the alert disabled?. + "operator": + "UNSPECIFIED_OPERATOR", # Optional. Default value is + "UNSPECIFIED_OPERATOR". Known values are: + "UNSPECIFIED_OPERATOR", "GREATER_THAN", and "LESS_THAN". + "rule": "UNSPECIFIED_RULE", + # Optional. Default value is "UNSPECIFIED_RULE". Known + values are: "UNSPECIFIED_RULE", "CPU_UTILIZATION", + "MEM_UTILIZATION", "RESTART_COUNT", "DEPLOYMENT_FAILED", + "DEPLOYMENT_LIVE", "DOMAIN_FAILED", "DOMAIN_LIVE", + "FUNCTIONS_ACTIVATION_COUNT", + "FUNCTIONS_AVERAGE_DURATION_MS", + "FUNCTIONS_ERROR_RATE_PER_MINUTE", + "FUNCTIONS_AVERAGE_WAIT_TIME_MS", + "FUNCTIONS_ERROR_COUNT", and + "FUNCTIONS_GB_RATE_PER_SECOND". + "value": 0.0, # Optional. + Threshold value for alert. + "window": + "UNSPECIFIED_WINDOW" # Optional. Default value is + "UNSPECIFIED_WINDOW". Known values are: + "UNSPECIFIED_WINDOW", "FIVE_MINUTES", "TEN_MINUTES", + "THIRTY_MINUTES", and "ONE_HOUR". + } + ], + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "ingress": { + "rules": [ + { + "component": { + "name": "str", # The name of + the component to route to. Required. + "preserve_path_prefix": + "str", # Optional. An optional flag to preserve the path + that is forwarded to the backend service. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. Note: this is not applicable for + Functions Components and is mutually exclusive with + ``rewrite``. + "rewrite": "str" # Optional. + An optional field that will rewrite the path of the + component to be what is specified here. By default, the + HTTP request path will be trimmed from the left when + forwarded to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If you specified the rewrite to be + ``/v1/``"" , requests to ``/api/list`` would be rewritten + to ``/v1/list``. Note: this is mutually exclusive with + ``preserve_path_prefix``. + }, + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to + the client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. + The set of allowed HTTP request headers. This + configures the ``Access-Control-Allow-Headers`` + header. + ], + "allow_methods": [ + "str" # Optional. + The set of allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": + "str", # Optional. Exact string match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "prefix": + "str", # Optional. Prefix-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. + "regex": + "str" # Optional. RE2 style regex-based match. + Only 1 of ``exact``"" , ``prefix``"" , or + ``regex`` must be set. For more information about + RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. + The set of HTTP response headers that browsers are + allowed to access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. + An optional duration specifying how long browsers can + cache the results of a preflight request. This configures + the ``Access-Control-Max-Age`` header. + }, + "match": { + "path": { + "prefix": "str" # + Prefix-based match. For example, ``/api`` will match + ``/api``"" , ``/api/``"" , and any nested paths such + as ``/api/v1/endpoint``. Required. + } + }, + "redirect": { + "authority": "str", # + Optional. The authority/host to redirect to. This can be + a hostname or IP address. Note: use ``port`` to set the + port. + "port": 0, # Optional. The + port to redirect to. + "redirect_code": 0, # + Optional. The redirect code to use. Defaults to ``302``. + Supported values are 300, 301, 302, 303, 304, 307, 308. + "scheme": "str", # Optional. + The scheme to redirect to. Supported values are ``http`` + or ``https``. Default: ``https``. + "uri": "str" # Optional. An + optional URI path to redirect to. Note: if this is + specified the whole URI of the original request will be + overwritten to this value, irrespective of the original + request URI being matched. + } + } + ] + }, + "jobs": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "kind": "UNSPECIFIED", # Optional. Default + value is "UNSPECIFIED". * UNSPECIFIED: Default job type, will + auto-complete to POST_DEPLOY kind. * PRE_DEPLOY: Indicates a job + that runs before an app deployment. * POST_DEPLOY: Indicates a + job that runs after an app deployment. * FAILED_DEPLOY: Indicates + a job that runs after a component fails to deploy. Known values + are: "UNSPECIFIED", "PRE_DEPLOY", "POST_DEPLOY", and + "FAILED_DEPLOY". + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "maintenance": { + "archive": bool, # Optional. Indicates whether the + app should be archived. Setting this to true implies that enabled is + set to true. Note that this feature is currently in closed beta. + "enabled": bool # Optional. Indicates whether + maintenance mode should be enabled for the app. + }, + "region": "str", # Optional. The slug form of the + geographical origin of the app. Default: ``nearest available``. Known + values are: "ams", "nyc", "fra", "sfo", "sgp", "blr", "tor", "lon", and + "syd". + "services": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "health_check": { + "failure_threshold": 0, # Optional. + The number of failed health checks before considered + unhealthy. + "http_path": "str", # Optional. The + route path used for the HTTP health check ping. If not set, + the HTTP health check will be disabled and a TCP health check + used instead. + "initial_delay_seconds": 0, # + Optional. The number of seconds to wait before beginning + health checks. + "period_seconds": 0, # Optional. The + number of seconds to wait between health checks. + "port": 0, # Optional. The port on + which the health check will be performed. If not set, the + health check will be performed on the component's http_port. + "success_threshold": 0, # Optional. + The number of successful health checks before considered + healthy. + "timeout_seconds": 0 # Optional. The + number of seconds after which the check times out. + }, + "http_port": 0, # Optional. The internal + port on which this service's run command will listen. Default: + 8080 If there is not an environment variable with the name + ``PORT``"" , one will be automatically added with its value set + to the value of this field. + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "internal_ports": [ + 0 # Optional. The ports on which + this service will listen for internal traffic. + ], + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "protocol": "str", # Optional. The protocol + which the service uses to serve traffic on the http_port. * + ``HTTP``"" : The app is serving the HTTP protocol. Default. * + ``HTTP2``"" : The app is serving the HTTP/2 protocol. Currently, + this needs to be implemented in the service by serving HTTP/2 + cleartext (h2c). Known values are: "HTTP" and "HTTP2". + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "drain_seconds": 0, # Optional. The + number of seconds to wait between selecting a container + instance for termination and issuing the TERM signal. + Selecting a container instance for termination begins an + asynchronous drain of new requests on upstream + load-balancers. (Default 15). + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ], + "static_sites": [ + { + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "catchall_document": "str", # Optional. The + name of the document to use as the fallback for any requests to + documents that are not found when serving this static site. Only + 1 of ``catchall_document`` or ``error_document`` can be set. + "cors": { + "allow_credentials": bool, # + Optional. Whether browsers should expose the response to the + client-side JavaScript code when the request"u2019s + credentials mode is include. This configures the + ``Access-Control-Allow-Credentials`` header. + "allow_headers": [ + "str" # Optional. The set of + allowed HTTP request headers. This configures the + ``Access-Control-Allow-Headers`` header. + ], + "allow_methods": [ + "str" # Optional. The set of + allowed HTTP methods. This configures the + ``Access-Control-Allow-Methods`` header. + ], + "allow_origins": [ + { + "exact": "str", # + Optional. Exact string match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "prefix": "str", # + Optional. Prefix-based match. Only 1 of ``exact``"" , + ``prefix``"" , or ``regex`` must be set. + "regex": "str" # + Optional. RE2 style regex-based match. Only 1 of + ``exact``"" , ``prefix``"" , or ``regex`` must be + set. For more information about RE2 syntax, see: + https://github.com/google/re2/wiki/Syntax. + } + ], + "expose_headers": [ + "str" # Optional. The set of + HTTP response headers that browsers are allowed to + access. This configures the + ``Access-Control-Expose-Headers`` header. + ], + "max_age": "str" # Optional. An + optional duration specifying how long browsers can cache the + results of a preflight request. This configures the + ``Access-Control-Max-Age`` header. + }, + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "error_document": "404.html", # Optional. + Default value is "404.html". The name of the error document to + use when serving this static site. Default: 404.html. If no such + file exists within the built assets, App Platform will supply + one. + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "index_document": "index.html", # Optional. + Default value is "index.html". The name of the index document to + use when serving this static site. Default: index.html. + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "output_dir": "str", # Optional. An optional + path to where the built assets will be located, relative to the + build context. If not set, App Platform will automatically scan + for these directory names: ``_static``"" , ``dist``"" , + ``public``"" , ``build``. + "routes": [ + { + "path": "str", # Optional. + (Deprecated - Use Ingress Rules instead). An HTTP path + prefix. Paths must start with / and must be unique across + all components within an app. + "preserve_path_prefix": bool + # Optional. An optional flag to preserve the path that is + forwarded to the backend service. By default, the HTTP + request path will be trimmed from the left when forwarded + to the component. For example, a component with + ``path=/api`` will have requests to ``/api/list`` trimmed + to ``/list``. If this value is ``true``"" , the path will + remain ``/api/list``. + } + ], + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str" # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + } + ], + "workers": [ + { + "autoscaling": { + "max_instance_count": 0, # Optional. + The maximum amount of instances for this component. Must be + more than min_instance_count. + "metrics": { + "cpu": { + "percent": 80 # + Optional. Default value is 80. The average target CPU + utilization for the component. + } + }, + "min_instance_count": 0 # Optional. + The minimum amount of instances for this component. Must be + less than max_instance_count. + }, + "build_command": "str", # Optional. An + optional build command to run while building this component from + source. + "dockerfile_path": "str", # Optional. The + path to the Dockerfile relative to the root of the repo. If set, + it will be used to build this component. Otherwise, App Platform + will attempt to build it using buildpacks. + "environment_slug": "str", # Optional. An + environment slug describing the type of this app. For a full + list, please refer to `the product documentation + `_. + "envs": [ + { + "key": "str", # The variable + name. Required. + "scope": + "RUN_AND_BUILD_TIME", # Optional. Default value is + "RUN_AND_BUILD_TIME". * RUN_TIME: Made available only at + run-time * BUILD_TIME: Made available only at build-time + * RUN_AND_BUILD_TIME: Made available at both build and + run-time. Known values are: "UNSET", "RUN_TIME", + "BUILD_TIME", and "RUN_AND_BUILD_TIME". + "type": "GENERAL", # + Optional. Default value is "GENERAL". * GENERAL: A + plain-text environment variable * SECRET: A secret + encrypted environment variable. Known values are: + "GENERAL" and "SECRET". + "value": "str" # Optional. + The value. If the type is ``SECRET``"" , the value will + be encrypted on first submission. On following + submissions, the encrypted value should be used. + } + ], + "git": { + "branch": "str", # Optional. The + name of the branch to use. + "repo_clone_url": "str" # Optional. + The clone URL of the repo. Example: + ``https://github.com/digitalocean/sample-golang.git``. + }, + "github": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "gitlab": { + "branch": "str", # Optional. The + name of the branch to use. + "deploy_on_push": bool, # Optional. + Whether to automatically deploy new commits made to the repo. + "repo": "str" # Optional. The name + of the repo in the format owner/repo. Example: + ``digitalocean/sample-golang``. + }, + "image": { + "deploy_on_push": { + "enabled": bool # Optional. + Whether to automatically deploy new images. Can only be + used for images hosted in DOCR and can only be used with + an image tag, not a specific digest. + }, + "digest": "str", # Optional. The + image digest. Cannot be specified if tag is provided. + "registry": "str", # Optional. The + registry name. Must be left empty for the ``DOCR`` registry + type. + "registry_credentials": "str", # + Optional. The credentials to be able to pull the image. The + value will be encrypted on first submission. On following + submissions, the encrypted value should be used. * + "$username:$access_token" for registries of type + ``DOCKER_HUB``. * "$username:$access_token" for registries of + type ``GHCR``. + "registry_type": "str", # Optional. + * DOCKER_HUB: The DockerHub container registry type. * DOCR: + The DigitalOcean container registry type. * GHCR: The Github + container registry type. Known values are: "DOCKER_HUB", + "DOCR", and "GHCR". + "repository": "str", # Optional. The + repository name. + "tag": "latest" # Optional. Default + value is "latest". The repository tag. Defaults to ``latest`` + if not provided and no digest is provided. Cannot be + specified if digest is provided. + }, + "instance_count": 1, # Optional. Default + value is 1. The amount of instances that this component should be + scaled to. Default: 1. Must not be set if autoscaling is used. + "instance_size_slug": {}, + "log_destinations": [ + { + "name": "str", # Required. + "datadog": { + "api_key": "str", # + Datadog API key. Required. + "endpoint": "str" # + Optional. Datadog HTTP log intake endpoint. + }, + "logtail": { + "token": "str" # + Optional. Logtail token. + }, + "open_search": { + "basic_auth": { + "password": + {}, # Optional. Password for user defined in + User. Is required when ``endpoint`` is set. + Cannot be set if using a DigitalOcean DBaaS + OpenSearch cluster. + "user": "str" + # Optional. Username to authenticate with. Only + required when ``endpoint`` is set. Defaults to + ``doadmin`` when ``cluster_name`` is set. + }, + "cluster_name": + "str", # Optional. The name of a DigitalOcean DBaaS + OpenSearch cluster to use as a log forwarding + destination. Cannot be specified if ``endpoint`` is + also specified. + "endpoint": "str", # + Optional. OpenSearch API Endpoint. Only HTTPS is + supported. Format: + https://:code:``::code:``. Cannot be + specified if ``cluster_name`` is also specified. + "index_name": "logs" + # Optional. Default value is "logs". The index name + to use for the logs. If not set, the default index + name is "logs". + }, + "papertrail": { + "endpoint": "str" # + Papertrail syslog endpoint. Required. + } + } + ], + "name": "str", # Optional. The name. Must be + unique across all components within the same app. + "run_command": "str", # Optional. An + optional run command to override the component's default. + "source_dir": "str", # Optional. An optional + path to the working directory to use for the build. For + Dockerfile builds, this will be used as the build context. Must + be relative to the root of the repo. + "termination": { + "grace_period_seconds": 0 # + Optional. The number of seconds to wait between sending a + TERM signal to a container and issuing a KILL which causes + immediate shutdown. (Default 120). + } + } + ] + }, + "static_sites": [ + { + "name": "str", # Optional. The name of this static + site. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this static site. + } + ], + "tier_slug": "str", # Optional. The current pricing tier slug of the + deployment. + "updated_at": "2020-02-20 00:00:00", # Optional. When the deployment + was last updated. + "workers": [ + { + "name": "str", # Optional. The name of this worker. + "source_commit_hash": "str" # Optional. The commit + hash of the repository that was used to build this worker. + } + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = body + else: + _json = None + + _request = build_apps_restart_request( + app_id=app_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + @distributed_trace def get_logs_active_deployment( self,