ves-io-schema-api_credential-CustomAPI-CreateServiceCredentials

Examples of performing api_credential CustomAPI CreateServiceCredentials

Usecase:

Create service credentials

Request:

Request using vesctl:

vesctl request rpc api_credential.CustomAPI.CreateServiceCredentials -i request.yaml --uri /public/namespaces/system/service_credentials --http-method POST

where file request.yaml has following contents:

expirationDays: 20
name: user-1-service-creds
namespace: documentation
namespaceRoles:
- namespace: system
  role: ves-io-monitor-role
- namespace: shared
  role: ves-io-monitor-role
- namespace: app-ns1
  role: ves-io-developer-role
type: SERVICE_API_TOKEN

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"type":"SERVICE_API_TOKEN","namespace":"documentation","name":"user-1-service-creds","namespace_roles":[{"namespace":"system","role":"ves-io-monitor-role"},{"namespace":"shared","role":"ves-io-monitor-role"},{"namespace":"app-ns1","role":"ves-io-developer-role"}],"expiration_days":20}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build243329498_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/system/service_credentials'

curl response:

HTTP/1.1 200 OK
Content-Length: 81
Content-Type: application/json
Date: Fri, 23 Sep 2022 13:11:17 GMT
Vary: Accept-Encoding

{
  "data": "",
  "name": "",
  "active": false,
  "expiration_timestamp": null
}

Usecase:

Create service credentials

Request:

Request using vesctl:

vesctl request rpc api_credential.CustomAPI.CreateServiceCredentials -i request.yaml --uri /public/namespaces/system/service_credentials --http-method POST

where file request.yaml has following contents:

apiToken: null
expirationDays: 20
name: user-1-service-creds
namespace: documentation
namespaceRoles:
- namespace: system
  role: ves-io-monitor-role
- namespace: shared
  role: ves-io-monitor-role
- namespace: app-ns1
  role: ves-io-developer-role
type: SERVICE_API_TOKEN

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"type":"SERVICE_API_TOKEN","namespace":"documentation","name":"user-1-service-creds","namespace_roles":[{"namespace":"system","role":"ves-io-monitor-role"},{"namespace":"shared","role":"ves-io-monitor-role"},{"namespace":"app-ns1","role":"ves-io-developer-role"}],"expiration_days":20,"api_token":null}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build243329498_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/system/service_credentials'

curl response:

HTTP/1.1 200 OK
Content-Length: 81
Content-Type: application/json
Date: Fri, 23 Sep 2022 13:11:17 GMT
Vary: Accept-Encoding

{
  "data": "",
  "name": "",
  "active": false,
  "expiration_timestamp": null
}

Usecase:

Create service credentials

Request:

Request using vesctl:

vesctl request rpc api_credential.CustomAPI.CreateServiceCredentials -i request.yaml --uri /public/namespaces/system/service_credentials --http-method POST

where file request.yaml has following contents:

expirationDays: 20
name: user-1-service-creds
namespace: documentation
namespaceRoles:
- namespace: system
  role: ves-io-monitor-role
- namespace: shared
  role: ves-io-monitor-role
- namespace: app-ns1
  role: ves-io-developer-role
type: KUBE_CONFIG
vk8sKubeconfig:
  vk8sClusterName: virtual-k8s-name
  vk8sNamespace: virtual-k8s-namespace

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"type":"KUBE_CONFIG","namespace":"documentation","name":"user-1-service-creds","namespace_roles":[{"namespace":"system","role":"ves-io-monitor-role"},{"namespace":"shared","role":"ves-io-monitor-role"},{"namespace":"app-ns1","role":"ves-io-developer-role"}],"expiration_days":20,"vk8s_kubeconfig":{"vk8s_namespace":"virtual-k8s-namespace","vk8s_cluster_name":"virtual-k8s-name"}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build243329498_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/system/service_credentials'

curl response:

HTTP/1.1 200 OK
Content-Length: 81
Content-Type: application/json
Date: Fri, 23 Sep 2022 13:11:17 GMT
Vary: Accept-Encoding

{
  "data": "",
  "name": "",
  "active": false,
  "expiration_timestamp": null
}

Usecase:

Create service credentials

Request:

Request using vesctl:

vesctl request rpc api_credential.CustomAPI.CreateServiceCredentials -i request.yaml --uri /public/namespaces/system/service_credentials --http-method POST

where file request.yaml has following contents:

apiCertificate:
  password: passW@Rd!
expirationDays: 20
name: user-1-service-creds
namespace: documentation
namespaceRoles:
- namespace: system
  role: ves-io-monitor-role
- namespace: shared
  role: ves-io-monitor-role
- namespace: app-ns1
  role: ves-io-developer-role

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"namespace":"documentation","name":"user-1-service-creds","namespace_roles":[{"namespace":"system","role":"ves-io-monitor-role"},{"namespace":"shared","role":"ves-io-monitor-role"},{"namespace":"app-ns1","role":"ves-io-developer-role"}],"expiration_days":20,"api_certificate":{"password":"passW@Rd!"}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build243329498_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/system/service_credentials'

curl response:

HTTP/1.1 200 OK
Content-Length: 81
Content-Type: application/json
Date: Fri, 23 Sep 2022 13:11:17 GMT
Vary: Accept-Encoding

{
  "data": "",
  "name": "",
  "active": false,
  "expiration_timestamp": null
}