Provider Support

Provider management including CRUD operations as well as the refresh action is available via the REST API. Management of providers is through:

/api/providers

Querying Providers

Providers can be queried as follows:

GET /api/providers

A specific provider can also be queried by its id:

GET /api/providers/:id

Foreman type providers can be queried by specifying the provider_class as follows:

GET /api/providers?provider_class=provider

Cloud Networks

The Cloud Networks of a provider can be queried by asking for the cloud_networks subcollection as follows:

GET /api/providers/:id/cloud_networks
GET /api/providers/:id/cloud_networks/:cloud_network_id

Or expanding the Cloud Networks in addition to the provider as follows:

GET /api/providers/:id?expand=cloud_networks

Creating Providers

Creating a provider is done via the create action as follows:

POST /api/providers
{
  "action" : "create",
  "resource" : {
    # New Provider JSON
  }
}

And like other create actions, the new provider data can simply be posted to the /api/providers URL.

POST /api/providers
{
  # New Provider JSON
}

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

For example, creating a VMware type provider:

POST /api/providers
{
  "name" : "vCenter 5",
  "type" : "ManageIQ::Providers::Vmware::InfraManager",
  "hostname" : "my_vcenter_50",
  "ipaddress" : "192.168.150.1",
  "zone" :  { "href" : "http://localhost:3000/api/zone/1" },
  "credentials" :  {
    "userid" : "vcenter_admin",
    "password" : "vcenter_password"
  }
}

If zone is not specified, the Default zone will be used.

The type attribute specifies the supported provider class names which include:

ManageIQ::Providers::Amazon::CloudManager

ManageIQ::Providers::Azure::CloudManager

ManageIQ::Providers::Google::CloudManager

ManageIQ::Providers::Hawkular::MiddlewareManager

ManageIQ::Providers::Kubernetes::ContainerManager

ManageIQ::Providers::Microsoft::InfraManager

ManageIQ::Providers::Openshift::ContainerManager

ManageIQ::Providers::OpenshiftEnterprise::ContainerManager

ManageIQ::Providers::Openstack::CloudManager

ManageIQ::Providers::Openstack::InfraManager

ManageIQ::Providers::Redhat::InfraManager

ManageIQ::Providers::Vmware::CloudManager

ManageIQ::Providers::Vmware::InfraManager

Please note that the provider type classes have changed in the appliance from earlier releases (v2.0.0 of the API). Please refer to the Provider Types page for a mapping from the old to the new types.

Specifying Credentials

When creating or updating providers, the credentials can be specified as a a single default set, or a compound set where additional credentials are necessary for let’s say AMPQ for OpenStack or Metrics for RHEVM.

Single default credentials set:

{
  "name" : "vCenter 50",
  "type" : "ManageIQ::Providers::Vmware::InfraManager",
  ...
  "credentials" :  {
    "userid" : "vc_admin",
    "password" : "vc_password"
  }
}

Compound credentials set:

{
  "name" : "RHEVM",
  "type" : " ManageIQ::Providers::Redhat::InfraManager",
  ...
  "credentials" : [
     {
       "userid"    : "default_userid",
       "password"  : "default_password"
     },
     {
       "userid"    : "metrics_userid",
       "password"  : "metrics_password",
       "auth_type" : "metrics"
     }
  ]
}

Editing Providers

Editing provider is available via the edit action with the resource specifying the attributes to update for that provider.

POST /api/providers/:id
{
  "action" : "edit" ,
  "resource" : {
    "hostname" : "new_vcenter_50",
    "ipaddress" : "192.168.150.2"
  }
}
type is a restricted attribute and cannot be edited.

Deleting Providers

Deleting a provider is done via the delete method:

DELETE /api/providers/:id

or via the delete action as follows:

POST /api/providers/:id
{
  "action" : "delete"
}

or by href:

POST /api/providers
{
  "action" : "delete",
  "resources" : [
    { "href" : "http://localhost:3000/api/providers/:id" }
  ]
}

Refresh Providers

Performing a refresh of providers is done via the refresh action.

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

You can also refresh multiple providers:

POST /api/providers
{
  "action" : "refresh",
  "resources" : [
    { "href" : "http://localhost:3000/api/providers/:id" },
    { "href" : "http://localhost:3000/api/providers/:id" }
  ]
}

Foreman Support

Management of Foreman providers is provided as a seperate class of providers. This is still accessed via the /api/providers entry point, but enabled by a new parameter:

  GET|POST|DELETE /api/providers?provider_class=provider

The provider_class parameter is supported with /api/provider for all CRUD operations including the refresh action.

An example of creating a Foreman provider:

POST /api/providers?provider_class=provider
{
  "type"      : "ManageIQ::Providers::Foreman::Provider",
  "name"      : "new_foreman_111",
  "url"       : "100.200.300.111",
  "credentials" : {
    "userid"   : "foreman_admin",
    "password" : "foreman_password"
  }
}

When creating providers with provider_class as provider, the type attribute specifies the supported provider class names which include:

ManageIQ::Providers::AnsibleTower::Provider

ManageIQ::Providers::Foreman::Provider

ManageIQ::Providers::Openstack::Provider

When managing providers of provider provider_class, Tagging and Policy management does not currently apply. So requests including the tags, policies and policy_profiles subcollections will be rejected.