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: "2021-02-22T15:43:29.629827400Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: d8c349e9-2b00-4787-86e9-3b4cb7d0c075

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-build817539475_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: 1296
Content-Type: application/json
Date: Mon, 22 Feb 2021 15:43:29 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "app-setting",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "d8c349e9-2b00-4787-86e9-3b4cb7d0c075",
    "creation_timestamp": "2021-02-22T15:43:29.629827400Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "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"
              ]
            }
          ]
        },
        "business_logic_markup_setting": null,
        "user_behavior_analysis_setting": null
      }
    ]
  }
}