Admiral

Components

Import an artifact from a registry, repository or URL

POST
/v1/components/import

resource_name is the component, always. The import that creates it needs source_id and sets the component's origin to that source and artifact. A later import under the same name is a bump: source_id and artifact may be left empty, and the origin supplies them.

version is an exact version as ListSourceVersions spells it, the keyword latest, or a semver range such as ^2, ~2.39 or >=2.39 <3. Admiral resolves a range or latest once, against a fresh read of the upstream rather than the cached list ListSourceVersions serves, and only over the versions the source's allows permits. It stores the exact version. A range or a keyword never reaches a changeset or an environment pin.

Any member who can read the source may import a new version of an existing component through its origin, since the caller chooses only which allowed version to take. Creating a component by import needs no permission to create components, since the source already bounds it.

  • INVALID_ARGUMENT when the import would create the component and names no source_id.
  • FAILED_PRECONDITION when the component was published by hand, or when source_id or artifact differs from its origin. The message names SetComponentOrigin, which moves the origin.
  • FAILED_PRECONDITION when the artifact or the resolved version is outside the source's allows, when the resolved version is revoked, or when no permitted version matches version.

An archive at a URL is not importable, since an archive has no versions. A git source at a tag covers it.

Scope: component:publish

Authorization

bearerAuth
AuthorizationBearer <token>

An API key, or an access token minted from one. Pass it in the Authorization header: Bearer admp_...

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

ImportComponentRequest names the component, the source and the version to import. import_component.tags.tag_not_an_id // a tag cannot start with ver-, which marks a version id

Response Body

application/json

curl -X POST "https://example.com/v1/components/import" \  -H "Content-Type: application/json" \  -d '{    "resource_name": "string",    "version": "string"  }'
{  "component": {    "id": "string",    "name": "string",    "display_name": "string",    "resource_name": "string",    "description": "string",    "labels": {      "property1": "string",      "property2": "string"    },    "kind": "KIND_UNSPECIFIED",    "origin": {      "published": {}    },    "tags": [      {        "name": "string",        "resource_name": "string",        "digest": "string",        "immutable": true,        "etag": "string",        "created_at": "2023-01-15T01:30:15.01Z",        "updated_at": "2023-01-15T01:30:15.01Z"      }    ],    "status": "STATUS_UNSPECIFIED",    "status_reason": "string",    "status_changed_at": "2023-01-15T01:30:15.01Z",    "successor_id": "string",    "etag": "string",    "created_by": {      "id": "string",      "display_name": "string",      "email": "string"    },    "created_at": "2023-01-15T01:30:15.01Z",    "updated_at": "2023-01-15T01:30:15.01Z"  },  "version": {    "id": "string",    "resource_name": "string",    "component_id": "string",    "digest": "string",    "kind": "KIND_UNSPECIFIED",    "size_bytes": "string",    "contract": {      "inputs": [        {          "name": "string",          "type": "string",          "description": "string",          "required": true,          "default": null,          "sensitive": true,          "ephemeral": true,          "nullable": true,          "deprecated": "string",          "validations": [            {              "condition": "string",              "error_message": "string"            }          ],          "schema": {            "property1": null,            "property2": null          }        }      ],      "outputs": [        {          "name": "string",          "description": "string",          "sensitive": true        }      ]    },    "baseline_values_json": "string",    "requirements": {      "infra": {        "required_version": "string",        "providers": [          "string"        ]      }    },    "provenance": {      "kind": "KIND_UNSPECIFIED",      "uri": "string",      "ref": "string",      "commit": "string",      "path": "string",      "dependencies": [        {          "source": "string",          "constraint": "string",          "resolved": "string"        }      ],      "credentials": [        {          "credential_id": "string",          "name": "string",          "hosts": [            "string"          ]        }      ],      "commit_message": "string",      "commit_author": "string",      "source_id": "string"    },    "findings": [      {        "severity": "FINDING_SEVERITY_UNSPECIFIED",        "source": "string",        "code": "string",        "message": "string",        "path": "string"      }    ],    "tags": [      "string"    ],    "status": "STATUS_UNSPECIFIED",    "status_reason": "string",    "status_changed_at": "2023-01-15T01:30:15.01Z",    "created_by": {      "id": "string",      "display_name": "string",      "email": "string"    },    "created_at": "2023-01-15T01:30:15.01Z"  },  "unchanged": true,  "resolved_from": "string"}