Authentications

Management of authentications is provided via the following collection:

/api/authentications

Full CRUD actions on authentications is available:

Querying Authentications

Querying all authentications in the system is simply:

GET /api/authentications

Getting details on a specific authentication:

GET /api/authentications/:id

One can also query authentications of a configuration script payload’s manager as follows:

GET /api/configuration_script_payloads/:id/authentications

Or getting details on a specific authentication:

GET /api/configuration_script_payloads/:id/authentications/:authentication_id

Creating Authentications

Authentications can be created via a POST to the authentications collection or via the create action signature which also allows creation of multiple authentications in a single request.

POST /api/authentications
{
  "description" : "Authentication Description",
  "name" : "SomeCredentials",
  "related" : {},
  "type" : "ManageIQ::Providers::AnsibleTower::AutomationManager::Credential",
  "manager_resource" : { "href" : "http://localhost:3000/api/providers/7" }
}

or creating multiple authentications:

{
  "action" : "create",
  "resources" : [
    { "description" : "System Credentials", "name" : "SystemCreds", ... },
    { "description" : "Admin Credentials",  "name" : "AdminCreds", ... },
    ...
  ]
}

Optionally, authentications can be created for a provider of a specific configuration script payload, thus eliminating the need of specifying a provider.

POST /api/configuration_script_payloads/:id/authentications
{
  "description" : "Authentication Description",
  "name" : "SomeCredentials",
  "related" : {},
  "type" : "ManageIQ::Providers::AnsibleTower::AutomationManager::Credential"
}

Also supporting bulk creates:

{
  "action" : "create",
  "resources" : [
    { "description" : "System Credentials", "name" : "SystemCreds", ... },
    { "description" : "Admin Credentials",  "name" : "AdminCreds", ... },
    ...
  ]
}

Note:

Please refer to the Resource Attributes page for a list of available attributes when creating authentications.

Editing Authentications

POST /api/authentications/:id
{
  "action" : "edit",
  "resource" : {
    "name" : "UpdatedCredentials"
  }
}

or editing multiple authentications:

POST /api/authentications
{
  "action" : "edit",
  "resources" : [
    {
      "href" : "http://localhost:3000/api/authentications/101",
      "description" : "Updated Sample Credentials 1",
      "name" : "UpdatedCredentials1"
    },
    {
      "href" : "http://localhost:3000/api/authentications/102",
      "description" : "Updated Sample Credentials 2",
      "name" : "UpdatedCredentials2"
    },
    ...
  ]
}

Refreshing Authentications

Authentications can be refreshed by posting a refresh action to a single resource or to multiple resources in bulk by targeting the collection.

POST /api/authentications/:id
{
  "action" : "refresh"
}

or refreshing multiple authentications:

POST /api/authentications
{
  "action" : "refresh",
  "resources" : [
    { "id" : "51" },
    { "id" : "52" }
  ]
}

Example:

POST /api/authentications/51
{
  "action" : "refresh"
}

Response:

{
  "success" : true,
  "message" : "Refreshing Authentication id:51 name:'SampleCredentials'",
  "task_id" : "8",
  "task_href" : "http://localhost:3000/api/tasks/8",
  "tasks" : [
    {
      "id" : "8",
      "href" : "http://localhost:3000/api/tasks/8"
    }
  ]
}

Deleting Authentications

Authentications can be deleted via either the delete POST action or via the DELETE HTTP method.

POST /api/authentications/101
{
  "action" : "delete"
}

or simply:

DELETE /api/authentications/101

Deleting multiple authentications can be done as follows:

POST /api/authentications
{
  "action" : "delete",
  "resources" : [
    { "href" : "http://localhost:3000/api/authentications/101" },
    { "href" : "http://localhost:3000/api/authentications/102" },
    ...
  ]
}