ves-io-schema-app_setting-API-Create

Examples of creating app_setting

Usecase:

Create appsetting in namespace documentation that uses apptype bookinfo. There can only be one app_setting in a namespace.

Request using vesctl:

vesctl configuration create app_setting -i app_setting.yaml

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

metadata:
  name: app-setting
  namespace: documentation
spec:
  appTypeSettings:
  - appTypeRef:
    - kind: app_type
      name: bookinfo
      namespace: shared
      tenant: acmecorp
    timeseriesAnalysesSetting:
      metricSelectors:
      - metric:
        - REQUEST_RATE
        metricsSource: VIRTUAL_HOSTS

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: app-setting
  namespace: documentation
spec:
  anomalyTypes: []
  appTypeRefs: []
  appTypeSettings:
  - appTypeRef:
    - kind: app_type
      name: bookinfo
      namespace: shared
      tenant: acmecorp
      uid: ffffffff-ffff-ffff-ffff-ffffffffffff
    timeseriesAnalysesSetting:
      metricSelectors:
      - metric:
        - REQUEST_RATE
        metricsSource: VIRTUAL_HOSTS
systemMetadata:
  creationTimestamp: "2020-05-15T10:52:29.173689462Z"
  creatorClass: examplesvc.ves.io
  finalizers: []
  tenant: acmecorp
  uid: d365170a-53db-4ef8-8fba-2c501b6537d0

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"app-setting","namespace":"documentation"},"spec":{"appTypeSettings":[{"appTypeRef":[{"kind":"app_type","tenant":"acmecorp","namespace":"shared","name":"bookinfo"}],"timeseriesAnalysesSetting":{"metricSelectors":[{"metricsSource":"VIRTUAL_HOSTS","metric":["REQUEST_RATE"]}]}}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build144460626_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/app_settings'

curl response:

HTTP/1.1 200 OK
Content-Length: 1198
Content-Type: application/json
Date: Fri, 15 May 2020 10:52:29 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "app-setting",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "d365170a-53db-4ef8-8fba-2c501b6537d0",
    "creation_timestamp": "2020-05-15T10:52:29.173689462Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc.ves.io",
    "creator_id": "",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "app_type_refs": [
    ],
    "anomaly_types": [
    ],
    "app_type_settings": [
      {
        "app_type_ref": [
          {
            "kind": "app_type",
            "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
            "tenant": "acmecorp",
            "namespace": "shared",
            "name": "bookinfo"
          }
        ],
        "timeseries_analyses_setting": {
          "metric_selectors": [
            {
              "metrics_source": "VIRTUAL_HOSTS",
              "metric": [
                "REQUEST_RATE"
              ]
            }
          ]
        }
      }
    ]
  }
}