Mutators API

The /mutators API endpoint

/mutators (GET)

The /mutators API endpoint provides HTTP GET access to mutator data.

EXAMPLE

The following example demonstrates a request to the /mutators API, resulting in a JSON Array containing mutator definitions.

curl -s http://127.0.0.1:8080/api/core/v2/namespaces/default/mutators -H "Authorization: Bearer TOKEN"
[
  {
    "metadata": {
      "name": "example-mutator",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "command": "example_mutator.go",
    "timeout": 0,
    "env_vars": [],
    "runtime_assets": []
  }
]

API Specification

/mutators (GET)
description Returns the list of mutators.
example url http://hostname:8080/api/core/v2/namespaces/default/mutators
response type Array
response codes
  • Success: 200 (OK)
  • Error: 500 (Internal Server Error)
output
[
  {
    "metadata": {
      "name": "example-mutator",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "command": "example_mutator.go",
    "timeout": 0,
    "env_vars": [],
    "runtime_assets": []
  }
]

/mutators (POST)

/mutators (POST)
description Create a Sensu mutator.
example URL http://hostname:8080/api/core/v2/namespaces/default/mutators
payload
{
  "metadata": {
    "name": "example-mutator",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "command": "example_mutator.go",
  "timeout": 0,
  "env_vars": [],
  "runtime_assets": []
}
response codes
  • Success: 200 (OK)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

The /mutators/:mutator API endpoint

/mutators/:mutator (GET)

The /mutators/:mutator API endpoint provides HTTP GET access to mutator data for specific :mutator definitions, by mutator name.

EXAMPLE

In the following example, querying the /mutators/:mutator API returns a JSON Map containing the requested :mutator definition (in this example: for the :mutator named example-mutator).

curl -s http://127.0.0.1:8080/api/core/v2/namespaces/default/mutators/example-mutator -H "Authorization: Bearer TOKEN"
{
  "metadata": {
    "name": "example-mutator",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "command": "example_mutator.go",
  "timeout": 0,
  "env_vars": [],
  "runtime_assets": []
}

API Specification

/mutators/:mutator (GET)
description Returns a mutator.
example url http://hostname:8080/api/core/v2/namespaces/default/mutators/mutator-name
response type Map
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)
output
{
  "metadata": {
    "name": "example-mutator",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "command": "example_mutator.go",
  "timeout": 0,
  "env_vars": [],
  "runtime_assets": []
}

/mutators/:mutator (PUT)

API Specification

/mutators/:mutator (PUT)
description Create or update a Sensu mutator.
example URL http://hostname:8080/api/core/v2/namespaces/default/mutators/example-mutator
payload
{
  "metadata": {
    "name": "example-mutator",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "command": "example_mutator.go",
  "timeout": 0,
  "env_vars": [],
  "runtime_assets": []
}
response codes
  • Success: 201 (Created)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

/mutators/:mutator (DELETE)

API Specification

/mutators/:mutator (DELETE)
description Removes a mutator from Sensu given the mutator name.
example url http://hostname:8080/api/core/v2/namespaces/default/mutators/example-mutator
response codes
  • Success: 202 (Accepted)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)