Master
Versions: Euwe / Fine / Latest /

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

Load Balancers

Load Balancers of providers can be queried via the load_balancers subcollection as follows:

Query all Load Balancers of a provider:

GET /api/providers/:id/load_balancers

Query a specific Load Balancer of a provider:

GET /api/providers/:id/load_balancers/:load_balancer_id

Or expanding the Load Balancers for the specific provider as follows:

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

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::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"
     }
  ]
}

Specifying Connection Configurations

When creating or updating providers, connection configurations can be set. Connection configurations can be used to specify resources such as an amqp event provider for Openstack or for adding Hawkular metrics.

Hawkular metrics:

{
  "name": "Openshift Provider",
  "type": "ManageIQ::Providers::Openshift::ContainerManager",
  ...
  "connection_configurations": [
    {
      "endpoint": {
        "role"                  : "hawkular",
        "hostname"              : "hawkular_host",
        "port"                  : "1443",
        "security_protocol"     : "ssl-without-validation",
        "certificate_authority" : "-----BEGIN CERTIFICATE-----",
        "verify_ssl": 0
      },
      "authentication": {
        "role"     :  "hawkular",
        "auth_key" :  "hawkular_auth_key"
      }
    }
  ]
}

Amqp event provider:

{
  "name": "Openstack Provider",
  "type": "ManageIQ::Providers::Openstack::CloudManager",
  ...
  "connection_configurations": [
    {
      "endpoint": {
        "role"              : "amqp",
        "hostname"          : "amqphost.com",
        "port"              : "5672",
        "security_protocol" : "non-ssl"
      },
      "authentication": {
        "userid"   : "amqp_userid",
        "password" : "amqp_password",
        "role"     : "amqp"
      }
    }
  ]
}

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" }
  ]
}

Import Vm to Provider

Importing a VM into a provider is supported via the import_vm action.

This is currently supported for importing a Vm from a VMware vCenter provider into a Red Hat Virtualization provider.

POST /api/providers/:id
{
  "action" : "import_vm"
  "resource" : {
    "source" : { "href" : "http://localhost:3000/api/vms/11" },
    "target" : {
      "name"       : "new_vm_name",
      "cluster"    : { "href" : "http://localhost:3000/api/clusters/201" },
      "data_store" : { "href" : "http://localhost:3000/api/data_stores/301" },
      "sparse"     : true
    }
  }
}

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.