{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/queue/v1/post-artifact-request.json#",
  "$schema": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metaschema.json#",
  "description": "Request a authorization to put and artifact or posting of a URL as an artifact. Note that the `storageType` property is referenced in the response as well.",
  "oneOf": [
    {
      "additionalProperties": false,
      "description": "Request for a signed PUT URL that will allow you to upload an artifact\nto an S3 bucket managed by the queue.\n",
      "properties": {
        "contentLength": {
          "description": "Optional size of the artifact content, in bytes.\nThis is informational and used for monitoring purposes.\n",
          "minimum": 0,
          "type": "integer"
        },
        "contentType": {
          "description": "Artifact mime-type, when uploading artifact to the signed\n`PUT` URL returned from this request this must given with the\n `ContentType` header. Please, provide correct mime-type,\n this make tooling a lot easier, specifically,\n always using `application/json` for JSON artifacts.\n",
          "maxLength": 255,
          "type": "string"
        },
        "expires": {
          "description": "Date-time after which the artifact should be deleted. Note, that\nthese will be collected over time, and artifacts may remain\navailable after expiration. S3 based artifacts are identified in\nthe database and explicitly deleted on S3 after expiration.\n",
          "format": "date-time",
          "type": "string"
        },
        "storageType": {
          "description": "Artifact storage type, in this case `'s3'`\n",
          "enum": [
            "s3"
          ],
          "type": "string"
        }
      },
      "required": [
        "storageType",
        "expires",
        "contentType"
      ],
      "title": "S3 Artifact Request",
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "Request to create an artifact via the object service.\n",
      "properties": {
        "contentLength": {
          "description": "Optional size of the artifact content, in bytes.\nThis is informational and used for monitoring purposes.\n",
          "minimum": 0,
          "type": "integer"
        },
        "contentType": {
          "description": "Artifact content type.  This is advisory in nature and can be used,\nfor example, to select appropriate icons to display artifact links.\n",
          "maxLength": 255,
          "type": "string"
        },
        "expires": {
          "description": "Date-time after which the artifact should be deleted.\n",
          "format": "date-time",
          "type": "string"
        },
        "storageType": {
          "description": "Artifact storage type, in this case `'object'`\n",
          "enum": [
            "object"
          ],
          "type": "string"
        }
      },
      "required": [
        "storageType",
        "expires",
        "contentType"
      ],
      "title": "Object Artifact Request",
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "Request the queue to redirect fetches for this artifact to a URL.  An\nexisting artifact can be replaced with a RedirectArtifact as long as the\ntask is still executing.  When a RedirectArtifact is fetched, the URL is\nreturned verbatim as a Location header in a 303 (See Other) response.\nClients will not apply any form of authentication to that URL.\n",
      "properties": {
        "contentType": {
          "description": "Expected content-type of the artifact.  This is informational only:\nit is suitable for use to choose an icon for the artifact, for example.\nThe accurate content-type of the artifact can only be determined by\ndownloading it.\n",
          "maxLength": 255,
          "type": "string"
        },
        "expires": {
          "description": "Date-time after which the queue should no longer redirect to this URL.\nNote, that the queue will and cannot delete the resource your URL\nreferences, you are responsible for doing that yourself.\n",
          "format": "date-time",
          "type": "string"
        },
        "storageType": {
          "description": "Artifact storage type, in this case `reference`\n",
          "enum": [
            "reference"
          ],
          "type": "string"
        },
        "url": {
          "description": "URL to which the queue should redirect using a `303` (See other)\nredirect.\n",
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "storageType",
        "expires",
        "url",
        "contentType"
      ],
      "title": "Redirect Artifact Request",
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "Request the queue to link this artifact to the named artifact on the same\ntask.  When a client fetches this artifact, the request will be treated as\nif the client fetched the linked artifact (including corresponding scope\nvalidation).  Note that the target artifact need not exist when this artifact\nis created.  It is allowed to create link cycles, but they will result in a\n400 response when fetched.\n",
      "properties": {
        "artifact": {
          "description": "Name of the artifact to which to link.\n",
          "type": "string"
        },
        "contentType": {
          "description": "Expected content-type of the artifact.  This is informational only:\nit is suitable for use to choose an icon for the artifact, for example.\nThe accurate content-type of the artifact can only be determined by\ndownloading it.  If this value is not provided, it will default to\n`application/binary`.\n",
          "maxLength": 255,
          "type": "string"
        },
        "expires": {
          "description": "Date-time after which the queue should no longer maintain this link.\n",
          "format": "date-time",
          "type": "string"
        },
        "storageType": {
          "description": "Artifact storage type, in this case `link`\n",
          "enum": [
            "link"
          ],
          "type": "string"
        }
      },
      "required": [
        "storageType",
        "expires",
        "artifact"
      ],
      "title": "Link Artifact Request",
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "Request the queue to reply `424` (Failed Dependency) with `reason` and\n`message` to any `GET` request for this artifact. This is mainly useful\nas a way for a task to declare that it failed to provide an artifact it\nwanted to upload.\n",
      "properties": {
        "expires": {
          "description": "Date-time after which the queue should stop replying with the error\nand forget about the artifact.\n",
          "format": "date-time",
          "type": "string"
        },
        "message": {
          "description": "Human readable explanation of why the artifact is missing\n",
          "maxLength": 4096,
          "type": "string"
        },
        "reason": {
          "description": "Reason why the artifact doesn't exist.\n",
          "enum": [
            "file-missing-on-worker",
            "invalid-resource-on-worker",
            "too-large-file-on-worker",
            "file-not-readable-on-worker"
          ],
          "type": "string"
        },
        "storageType": {
          "description": "Artifact storage type, in this case `error`\n",
          "enum": [
            "error"
          ],
          "type": "string"
        }
      },
      "required": [
        "storageType",
        "expires",
        "reason",
        "message"
      ],
      "title": "Error Artifact Request",
      "type": "object"
    }
  ],
  "title": "Post Artifact Request"
}