ves-io-schema-views-api_definition-API-Create

Examples of creating api_definition

Usecase:

Create api definition

Request using vesctl:

vesctl configuration create api_definition -i api_definition.yaml

where file apidefinition.yaml has following contents (apidefinition.CreateRequest):

metadata:
  name: api-definition-1
  namespace: shared
spec:
  swaggerSpecs:
  - /api/object_store/namespaces/shared/stored_objects/swagger/spec-1/v1-21-10-19

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: api-definition-1
  namespace: shared
spec:
  defaultApiGroupsBuilders: []
  swaggerSpecs:
  - /api/object_store/namespaces/shared/stored_objects/swagger/spec-1/v1-21-10-19
systemMetadata:
  creationTimestamp: "2022-01-12T14:51:28.912363100Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: 4929036e-fb6f-46c8-a5c9-22b12680097a

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"api-definition-1","namespace":"shared"},"spec":{"swaggerSpecs":["/api/object_store/namespaces/shared/stored_objects/swagger/spec-1/v1-21-10-19"]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build038462651_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/shared/api_definitions'

curl response:

HTTP/1.1 200 OK
Content-Length: 752
Content-Type: application/json
Date: Wed, 12 Jan 2022 14:51:28 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "api-definition-1",
    "namespace": "shared",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "4929036e-fb6f-46c8-a5c9-22b12680097a",
    "creation_timestamp": "2022-01-12T14:51:28.912363100Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "swagger_specs": [
      "/api/object_store/namespaces/shared/stored_objects/swagger/spec-1/v1-21-10-19"
    ],
    "default_api_groups_builders": [
    ]
  }
}