[ 
https://issues.apache.org/jira/browse/AMBARI-21824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Swapan Shridhar updated AMBARI-21824:
-------------------------------------
    Description: 
ServiceGroup was a new sub-resource added for cluster in AMBARI-21594.

This Task involves :
- moving *Services* which was earlier a sub-resource of *Cluster* under 
*ServiceGroup* now, and
-  using *Servicegroup* while doing Creation, Update and retrieval of 
*HostComponents* and *ServiceComponents*.
-  UI changes which includes creating a *default ServiceGroup named 'core'*, 
and all services created goes under it. Further, making UI calls SG aware, 
while making a call.

The new API calls will be the following:


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
*======*
*Service:*
*======*

New API calls: 

http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services
http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>

*POST*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services

Request

{code}
{
  "ServiceInfo" : {
    "cluster_name": "c1",
    "service_group_name": "core",
    "service_name": "RANGER",
    "service_display_name": "RANGER"
  }
}
{code}

Response

{code}
{
  "resources" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
      "ServiceInfo" : {
        "cluster_id" : 2,
        "cluster_name" : "c1",
        "credential_store_enabled" : false,
        "credential_store_supported" : false,
        "desired_repository_version_id" : "2.6.1.0-129",
        "desired_stack" : "HDP-2.6",
        "maintenance_state" : "OFF",
        "repository_state" : "NOT_REQUIRED",
        "service_display_name" : "RANGER",
        "service_group_id" : 2,
        "service_group_name" : "core",
        "service_id" : 4,
        "service_name" : "RANGER",
        "state" : "INIT"
      }
    }
  ]
}
{code}


*GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services";,
  "items" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
      "ServiceInfo" : {
        "cluster_name" : "c1",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
  "ServiceInfo" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "credential_store_enabled" : "false",
    "credential_store_supported" : "false",
    "desired_repository_version_id" : 1,
    "desired_stack" : {
      "stackName" : "HDP",
      "stackVersion" : "2.6",
      "stackId" : "HDP-2.6"
    },
    "maintenance_state" : "OFF",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "state" : "UNKNOWN"
  },
  "alerts_summary" : {
    "CRITICAL" : 0,
    "MAINTENANCE" : 0,
    "OK" : 0,
    "UNKNOWN" : 0,
    "WARNING" : 0
  },
  "alerts" : [ ],
  "components" : [ ],
  "artifacts" : [ ]
}
{code}


*DELETE*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER
Request

{code}
--
{code}

Response
{code}
{
  "deleteResult" : [
    {
      "deleted" : {
        "key" : "service_name: RANGER"
      }
    }
  ]
}
{code}



*================*
*Service Component*
*================*

New API calls: 

http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>/components/
http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>/components/ZOOKEEPER_SERVER


*POST*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/
Request

{code}
{
  "ServiceComponentInfo" : {
                "component_name" : "RANGER_USERSYNC"
        }
}       
{code}

Response

{code}
{
  "resources" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC/";,
      "ServiceComponentInfo" : {
        "category" : null,
        "cluster_id" : 2,
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "desired_stack" : "HDP-2.6",
        "desired_version" : "NOT_REQUIRED",
        "display_name" : "Ranger Usersync",
        "recovery_enabled" : false,
        "service_display_name" : "RANGER",
        "service_group_id" : 2,
        "service_group_name" : "core",
        "service_id" : 4,
        "service_name" : "RANGER",
        "state" : "INIT",
        "total_count" : {
          "installFailedCount" : 0,
          "unknownCount" : 0,
          "installedCount" : 0,
          "initCount" : 0,
          "startedCount" : 0,
          "totalCount" : 0
        }
      }
    }
  ]
}
{code}


*GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/";,
  "items" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}


Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
  "ServiceComponentInfo" : {
    "category" : "MASTER",
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_stack" : "HDP-2.6",
    "desired_version" : "2.6.1.0-129",
    "display_name" : "Ranger Usersync",
    "init_count" : 0,
    "install_failed_count" : 0,
    "installed_count" : 0,
    "recovery_enabled" : "false",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "started_count" : 0,
    "state" : "INIT",
    "total_count" : 0,
    "unknown_count" : 0
  },
  "host_components" : [ ]
}
{code}


*DELETE*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "deleteResult" : [
    {
      "deleted" : {
        "key" : "component_name: RANGER_USERSYNC"
      }
    }
  ]
}
{code}



*=============*
*Host Component*
*=============*

API URI remains same, but call's *body* and *Ambari backend* has notion of 
servicegroup embedded.

http://<hostname>:<port>/api/v1/clusters/c1/hosts/<HostName>/host_components/
http://<hostname>:<port>/api/v1/clusters/c1/hosts/<HostName>/host_components/<HostComponentName>


*POST*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/

Request

{code}
{
  "HostRoles" : {
   "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "service_group_name" : "core",
    "service_display_name" : "RANGER"
  }
}
{code}

Response

{code}
{
  "resources" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
      "HostRoles" : {
        "actual_configs" : { },
        "cluster_id" : 2,
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "desired_admin_state" : null,
        "desired_repository_version" : "2.6.1.0-129",
        "desired_stack_id" : "HDP-2.6",
        "display_name" : "Ranger Usersync",
        "host_name" : "c6404.ambari.apache.org",
        "id" : 7,
        "maintenance_state" : null,
        "public_host_name" : "c6404.ambari.apache.org",
        "service_display_name" : "RANGER",
        "service_group_id" : 2,
        "service_group_name" : "core",
        "service_id" : 4,
        "service_name" : "RANGER",
        "stale_configs" : false,
        "state" : "INIT",
        "upgrade_state" : "NONE",
        "version" : "UNKNOWN"
      },
      "host" : {
        "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
      }
    }
  ]
}
{code}


*GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/";,
  "items" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
      "HostRoles" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "host_name" : "c6404.ambari.apache.org",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      },
      "host" : {
        "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
      }
    }
{code}


Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
  "HostRoles" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_repository_version" : "2.6.1.0-129",
    "desired_stack_id" : "HDP-2.6",
    "desired_state" : "INIT",
    "display_name" : "Ranger Usersync",
    "host_name" : "c6404.ambari.apache.org",
    "id" : 7,
    "maintenance_state" : "OFF",
    "public_host_name" : "c6404.ambari.apache.org",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "stale_configs" : false,
    "state" : "INIT",
    "upgrade_state" : "NONE",
    "version" : "UNKNOWN",
    "actual_configs" : { }
  },
  "host" : {
    "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
  },
  "processes" : [ ],
  "component" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}


*DELETE*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "deleteResult" : [
    {
      "deleted" : {
        "key" : "component_name: RANGER_USERSYNC"
      }
    }
  ]
}
{code}


*-----------------------------------------------------------------------------------------------------------------------------------------------------*


*GET calls once Service, Service Component and Host Components are created:*


*SERVICE: GET*
 
Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
  "ServiceInfo" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "credential_store_enabled" : "false",
    "credential_store_supported" : "false",
    "desired_repository_version_id" : 1,
    "desired_stack" : {
      "stackName" : "HDP",
      "stackVersion" : "2.6",
      "stackId" : "HDP-2.6"
    },
    "maintenance_state" : "OFF",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "state" : "INIT"
  },
  "alerts_summary" : {
    "CRITICAL" : 0,
    "MAINTENANCE" : 0,
    "OK" : 0,
    "UNKNOWN" : 0,
    "WARNING" : 0
  },
  "alerts" : [ ],
  "components" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ],
  "artifacts" : [ ]
}
{code}


*SERVICE COMPONENT : GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
  "ServiceComponentInfo" : {
    "category" : "MASTER",
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_stack" : "HDP-2.6",
    "desired_version" : "2.6.1.0-129",
    "display_name" : "Ranger Usersync",
    "init_count" : 1,
    "install_failed_count" : 0,
    "installed_count" : 0,
    "recovery_enabled" : "false",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "started_count" : 0,
    "state" : "INIT",
    "total_count" : 1,
    "unknown_count" : 0
  },
  "host_components" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
      "HostRoles" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "host_name" : "c6404.ambari.apache.org",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}



*HOST COMPONENT : GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
  "HostRoles" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_repository_version" : "2.6.1.0-129",
    "desired_stack_id" : "HDP-2.6",
    "desired_state" : "INIT",
    "display_name" : "Ranger Usersync",
    "host_name" : "c6404.ambari.apache.org",
    "id" : 7,
    "maintenance_state" : "OFF",
    "public_host_name" : "c6404.ambari.apache.org",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "stale_configs" : false,
    "state" : "INIT",
    "upgrade_state" : "NONE",
    "version" : "UNKNOWN",
    "actual_configs" : { }
  },
  "host" : {
    "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
  },
  "component" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ],
  "processes" : [ ]
}
{code}



-----------------------------------------------------------------------------------------------------------------------------------------------------------------------





  was:
ServiceGroup was a new sub-resource added for cluster in AMBARI-21594.

This Task involves :
- moving *Services* which was earlier a sub-resource of *Cluster* under 
*ServiceGroup* now, and
-  using *Servicegroup* while doing Creation, Update and retrieval of 
*HostComponents* and *ServiceComponents*.
-  UI changes which includes creating a *default ServiceGroup named 'core'*, 
and all services created goes under it. Further, making UI calls SG aware, 
while making a call.

The new API calls will be the following:


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
*======*
*Service:*
*======*

http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services
http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>

*POST*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services

Request

{code}
{
  "ServiceInfo" : {
    "cluster_name": "c1",
    "service_group_name": "core",
    "service_name": "RANGER",
    "service_display_name": "RANGER"
  }
}
{code}

Response

{code}
{
  "resources" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
      "ServiceInfo" : {
        "cluster_id" : 2,
        "cluster_name" : "c1",
        "credential_store_enabled" : false,
        "credential_store_supported" : false,
        "desired_repository_version_id" : "2.6.1.0-129",
        "desired_stack" : "HDP-2.6",
        "maintenance_state" : "OFF",
        "repository_state" : "NOT_REQUIRED",
        "service_display_name" : "RANGER",
        "service_group_id" : 2,
        "service_group_name" : "core",
        "service_id" : 4,
        "service_name" : "RANGER",
        "state" : "INIT"
      }
    }
  ]
}
{code}

*GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services";,
  "items" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
      "ServiceInfo" : {
        "cluster_name" : "c1",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
  "ServiceInfo" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "credential_store_enabled" : "false",
    "credential_store_supported" : "false",
    "desired_repository_version_id" : 1,
    "desired_stack" : {
      "stackName" : "HDP",
      "stackVersion" : "2.6",
      "stackId" : "HDP-2.6"
    },
    "maintenance_state" : "OFF",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "state" : "UNKNOWN"
  },
  "alerts_summary" : {
    "CRITICAL" : 0,
    "MAINTENANCE" : 0,
    "OK" : 0,
    "UNKNOWN" : 0,
    "WARNING" : 0
  },
  "alerts" : [ ],
  "components" : [ ],
  "artifacts" : [ ]
}
{code}


*DELETE*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER
Request

{code}
--
{code}

Response
{code}
{
  "deleteResult" : [
    {
      "deleted" : {
        "key" : "service_name: RANGER"
      }
    }
  ]
}
{code}

*===============*
*Service Component*
*===============*



*POST*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/
Request

{code}
{
  "ServiceComponentInfo" : {
                "component_name" : "RANGER_USERSYNC"
        }
}       
{code}

Response

{code}
{
  "resources" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC/";,
      "ServiceComponentInfo" : {
        "category" : null,
        "cluster_id" : 2,
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "desired_stack" : "HDP-2.6",
        "desired_version" : "NOT_REQUIRED",
        "display_name" : "Ranger Usersync",
        "recovery_enabled" : false,
        "service_display_name" : "RANGER",
        "service_group_id" : 2,
        "service_group_name" : "core",
        "service_id" : 4,
        "service_name" : "RANGER",
        "state" : "INIT",
        "total_count" : {
          "installFailedCount" : 0,
          "unknownCount" : 0,
          "installedCount" : 0,
          "initCount" : 0,
          "startedCount" : 0,
          "totalCount" : 0
        }
      }
    }
  ]
}
{code}


*GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/";,
  "items" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}


Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
  "ServiceComponentInfo" : {
    "category" : "MASTER",
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_stack" : "HDP-2.6",
    "desired_version" : "2.6.1.0-129",
    "display_name" : "Ranger Usersync",
    "init_count" : 0,
    "install_failed_count" : 0,
    "installed_count" : 0,
    "recovery_enabled" : "false",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "started_count" : 0,
    "state" : "INIT",
    "total_count" : 0,
    "unknown_count" : 0
  },
  "host_components" : [ ]
}
{code}


*DELETE*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "deleteResult" : [
    {
      "deleted" : {
        "key" : "component_name: RANGER_USERSYNC"
      }
    }
  ]
}
{code}

*============*
*Host Component*
*============*

*POST*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/

Request

{code}
{
  "HostRoles" : {
   "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "service_group_name" : "core",
    "service_display_name" : "RANGER"
  }
}
{code}

Response

{code}
{
  "resources" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
      "HostRoles" : {
        "actual_configs" : { },
        "cluster_id" : 2,
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "desired_admin_state" : null,
        "desired_repository_version" : "2.6.1.0-129",
        "desired_stack_id" : "HDP-2.6",
        "display_name" : "Ranger Usersync",
        "host_name" : "c6404.ambari.apache.org",
        "id" : 7,
        "maintenance_state" : null,
        "public_host_name" : "c6404.ambari.apache.org",
        "service_display_name" : "RANGER",
        "service_group_id" : 2,
        "service_group_name" : "core",
        "service_id" : 4,
        "service_name" : "RANGER",
        "stale_configs" : false,
        "state" : "INIT",
        "upgrade_state" : "NONE",
        "version" : "UNKNOWN"
      },
      "host" : {
        "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
      }
    }
  ]
}
{code}


*GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/";,
  "items" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
      "HostRoles" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "host_name" : "c6404.ambari.apache.org",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      },
      "host" : {
        "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
      }
    }
{code}


Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
  "HostRoles" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_repository_version" : "2.6.1.0-129",
    "desired_stack_id" : "HDP-2.6",
    "desired_state" : "INIT",
    "display_name" : "Ranger Usersync",
    "host_name" : "c6404.ambari.apache.org",
    "id" : 7,
    "maintenance_state" : "OFF",
    "public_host_name" : "c6404.ambari.apache.org",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "stale_configs" : false,
    "state" : "INIT",
    "upgrade_state" : "NONE",
    "version" : "UNKNOWN",
    "actual_configs" : { }
  },
  "host" : {
    "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
  },
  "processes" : [ ],
  "component" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}


*DELETE*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "deleteResult" : [
    {
      "deleted" : {
        "key" : "component_name: RANGER_USERSYNC"
      }
    }
  ]
}
{code}

-----------------------------------------------------------------------------------------------------------------------------------------------------

*GET calls once Service, Service Component and Host Components are created:*


*SERVICE: GET*
 
Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
  "ServiceInfo" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "credential_store_enabled" : "false",
    "credential_store_supported" : "false",
    "desired_repository_version_id" : 1,
    "desired_stack" : {
      "stackName" : "HDP",
      "stackVersion" : "2.6",
      "stackId" : "HDP-2.6"
    },
    "maintenance_state" : "OFF",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "state" : "INIT"
  },
  "alerts_summary" : {
    "CRITICAL" : 0,
    "MAINTENANCE" : 0,
    "OK" : 0,
    "UNKNOWN" : 0,
    "WARNING" : 0
  },
  "alerts" : [ ],
  "components" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ],
  "artifacts" : [ ]
}
{code}


*SERVICE COMPONENT : GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
  "ServiceComponentInfo" : {
    "category" : "MASTER",
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_stack" : "HDP-2.6",
    "desired_version" : "2.6.1.0-129",
    "display_name" : "Ranger Usersync",
    "init_count" : 1,
    "install_failed_count" : 0,
    "installed_count" : 0,
    "recovery_enabled" : "false",
    "repository_state" : "NOT_REQUIRED",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "started_count" : 0,
    "state" : "INIT",
    "total_count" : 1,
    "unknown_count" : 0
  },
  "host_components" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
      "HostRoles" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "host_name" : "c6404.ambari.apache.org",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ]
}
{code}



*HOST COMPONENT : GET*

Eg: 
http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC

Request

{code}
--
{code}

Response

{code}
{
  "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
  "HostRoles" : {
    "cluster_id" : 2,
    "cluster_name" : "c1",
    "component_name" : "RANGER_USERSYNC",
    "desired_repository_version" : "2.6.1.0-129",
    "desired_stack_id" : "HDP-2.6",
    "desired_state" : "INIT",
    "display_name" : "Ranger Usersync",
    "host_name" : "c6404.ambari.apache.org",
    "id" : 7,
    "maintenance_state" : "OFF",
    "public_host_name" : "c6404.ambari.apache.org",
    "service_display_name" : "RANGER",
    "service_group_id" : 2,
    "service_group_name" : "core",
    "service_id" : 4,
    "service_name" : "RANGER",
    "stale_configs" : false,
    "state" : "INIT",
    "upgrade_state" : "NONE",
    "version" : "UNKNOWN",
    "actual_configs" : { }
  },
  "host" : {
    "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
  },
  "component" : [
    {
      "href" : 
"http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
      "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "RANGER_USERSYNC",
        "service_display_name" : "RANGER",
        "service_group_name" : "core"
      }
    }
  ],
  "processes" : [ ]
}
{code}


*ServiceComponent:*

http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>/components/
http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>/components/ZOOKEEPER_SERVER


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

*HostComponent:* (API remains same, but has notion of servicegroup in Ambari 
backend)

http://<hostname>:<port>/api/v1/clusters/c1/hosts/<HostName>/host_components/
http://<hostname>:<port>/api/v1/clusters/c1/hosts/<HostName>/host_components/<HostComponentName>





> Make services as sub-resource of ServiceGroups and use Servicegroup while 
> doing Creation, Update and retrieval of HostComponents and ServiceComponents.
> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMBARI-21824
>                 URL: https://issues.apache.org/jira/browse/AMBARI-21824
>             Project: Ambari
>          Issue Type: Task
>          Components: ambari-server, ambari-web
>    Affects Versions: 2.5.1
>            Reporter: Swapan Shridhar
>            Assignee: Swapan Shridhar
>             Fix For: 3.0.0
>
>
> ServiceGroup was a new sub-resource added for cluster in AMBARI-21594.
> This Task involves :
> - moving *Services* which was earlier a sub-resource of *Cluster* under 
> *ServiceGroup* now, and
> -  using *Servicegroup* while doing Creation, Update and retrieval of 
> *HostComponents* and *ServiceComponents*.
> -  UI changes which includes creating a *default ServiceGroup named 'core'*, 
> and all services created goes under it. Further, making UI calls SG aware, 
> while making a call.
> The new API calls will be the following:
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *======*
> *Service:*
> *======*
> New API calls: 
> http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services
> http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>
> *POST*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services
> Request
> {code}
> {
>   "ServiceInfo" : {
>     "cluster_name": "c1",
>     "service_group_name": "core",
>     "service_name": "RANGER",
>     "service_display_name": "RANGER"
>   }
> }
> {code}
> Response
> {code}
> {
>   "resources" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
>       "ServiceInfo" : {
>         "cluster_id" : 2,
>         "cluster_name" : "c1",
>         "credential_store_enabled" : false,
>         "credential_store_supported" : false,
>         "desired_repository_version_id" : "2.6.1.0-129",
>         "desired_stack" : "HDP-2.6",
>         "maintenance_state" : "OFF",
>         "repository_state" : "NOT_REQUIRED",
>         "service_display_name" : "RANGER",
>         "service_group_id" : 2,
>         "service_group_name" : "core",
>         "service_id" : 4,
>         "service_name" : "RANGER",
>         "state" : "INIT"
>       }
>     }
>   ]
> }
> {code}
> *GET*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services";,
>   "items" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
>       "ServiceInfo" : {
>         "cluster_name" : "c1",
>         "service_display_name" : "RANGER",
>         "service_group_name" : "core"
>       }
>     }
>   ]
> }
> {code}
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
>   "ServiceInfo" : {
>     "cluster_id" : 2,
>     "cluster_name" : "c1",
>     "credential_store_enabled" : "false",
>     "credential_store_supported" : "false",
>     "desired_repository_version_id" : 1,
>     "desired_stack" : {
>       "stackName" : "HDP",
>       "stackVersion" : "2.6",
>       "stackId" : "HDP-2.6"
>     },
>     "maintenance_state" : "OFF",
>     "repository_state" : "NOT_REQUIRED",
>     "service_display_name" : "RANGER",
>     "service_group_id" : 2,
>     "service_group_name" : "core",
>     "service_id" : 4,
>     "service_name" : "RANGER",
>     "state" : "UNKNOWN"
>   },
>   "alerts_summary" : {
>     "CRITICAL" : 0,
>     "MAINTENANCE" : 0,
>     "OK" : 0,
>     "UNKNOWN" : 0,
>     "WARNING" : 0
>   },
>   "alerts" : [ ],
>   "components" : [ ],
>   "artifacts" : [ ]
> }
> {code}
> *DELETE*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "deleteResult" : [
>     {
>       "deleted" : {
>         "key" : "service_name: RANGER"
>       }
>     }
>   ]
> }
> {code}
> *================*
> *Service Component*
> *================*
> New API calls: 
> http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>/components/
> http://<hostname>:<port>/api/v1/clusters/<clusterName>/*servicegroups/<ServiceGroupName>*/services/<ServiceName>/components/ZOOKEEPER_SERVER
> *POST*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/
> Request
> {code}
> {
>   "ServiceComponentInfo" : {
>               "component_name" : "RANGER_USERSYNC"
>       }
> }     
> {code}
> Response
> {code}
> {
>   "resources" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC/";,
>       "ServiceComponentInfo" : {
>         "category" : null,
>         "cluster_id" : 2,
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "desired_stack" : "HDP-2.6",
>         "desired_version" : "NOT_REQUIRED",
>         "display_name" : "Ranger Usersync",
>         "recovery_enabled" : false,
>         "service_display_name" : "RANGER",
>         "service_group_id" : 2,
>         "service_group_name" : "core",
>         "service_id" : 4,
>         "service_name" : "RANGER",
>         "state" : "INIT",
>         "total_count" : {
>           "installFailedCount" : 0,
>           "unknownCount" : 0,
>           "installedCount" : 0,
>           "initCount" : 0,
>           "startedCount" : 0,
>           "totalCount" : 0
>         }
>       }
>     }
>   ]
> }
> {code}
> *GET*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/";,
>   "items" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
>       "ServiceComponentInfo" : {
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "service_display_name" : "RANGER",
>         "service_group_name" : "core"
>       }
>     }
>   ]
> }
> {code}
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
>   "ServiceComponentInfo" : {
>     "category" : "MASTER",
>     "cluster_id" : 2,
>     "cluster_name" : "c1",
>     "component_name" : "RANGER_USERSYNC",
>     "desired_stack" : "HDP-2.6",
>     "desired_version" : "2.6.1.0-129",
>     "display_name" : "Ranger Usersync",
>     "init_count" : 0,
>     "install_failed_count" : 0,
>     "installed_count" : 0,
>     "recovery_enabled" : "false",
>     "repository_state" : "NOT_REQUIRED",
>     "service_display_name" : "RANGER",
>     "service_group_id" : 2,
>     "service_group_name" : "core",
>     "service_id" : 4,
>     "service_name" : "RANGER",
>     "started_count" : 0,
>     "state" : "INIT",
>     "total_count" : 0,
>     "unknown_count" : 0
>   },
>   "host_components" : [ ]
> }
> {code}
> *DELETE*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "deleteResult" : [
>     {
>       "deleted" : {
>         "key" : "component_name: RANGER_USERSYNC"
>       }
>     }
>   ]
> }
> {code}
> *=============*
> *Host Component*
> *=============*
> API URI remains same, but call's *body* and *Ambari backend* has notion of 
> servicegroup embedded.
> http://<hostname>:<port>/api/v1/clusters/c1/hosts/<HostName>/host_components/
> http://<hostname>:<port>/api/v1/clusters/c1/hosts/<HostName>/host_components/<HostComponentName>
> *POST*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/
> Request
> {code}
> {
>   "HostRoles" : {
>    "cluster_name" : "c1",
>     "component_name" : "RANGER_USERSYNC",
>     "service_group_name" : "core",
>     "service_display_name" : "RANGER"
>   }
> }
> {code}
> Response
> {code}
> {
>   "resources" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
>       "HostRoles" : {
>         "actual_configs" : { },
>         "cluster_id" : 2,
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "desired_admin_state" : null,
>         "desired_repository_version" : "2.6.1.0-129",
>         "desired_stack_id" : "HDP-2.6",
>         "display_name" : "Ranger Usersync",
>         "host_name" : "c6404.ambari.apache.org",
>         "id" : 7,
>         "maintenance_state" : null,
>         "public_host_name" : "c6404.ambari.apache.org",
>         "service_display_name" : "RANGER",
>         "service_group_id" : 2,
>         "service_group_name" : "core",
>         "service_id" : 4,
>         "service_name" : "RANGER",
>         "stale_configs" : false,
>         "state" : "INIT",
>         "upgrade_state" : "NONE",
>         "version" : "UNKNOWN"
>       },
>       "host" : {
>         "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
>       }
>     }
>   ]
> }
> {code}
> *GET*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/";,
>   "items" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
>       "HostRoles" : {
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "host_name" : "c6404.ambari.apache.org",
>         "service_display_name" : "RANGER",
>         "service_group_name" : "core"
>       },
>       "host" : {
>         "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
>       }
>     }
> {code}
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
>   "HostRoles" : {
>     "cluster_id" : 2,
>     "cluster_name" : "c1",
>     "component_name" : "RANGER_USERSYNC",
>     "desired_repository_version" : "2.6.1.0-129",
>     "desired_stack_id" : "HDP-2.6",
>     "desired_state" : "INIT",
>     "display_name" : "Ranger Usersync",
>     "host_name" : "c6404.ambari.apache.org",
>     "id" : 7,
>     "maintenance_state" : "OFF",
>     "public_host_name" : "c6404.ambari.apache.org",
>     "service_display_name" : "RANGER",
>     "service_group_id" : 2,
>     "service_group_name" : "core",
>     "service_id" : 4,
>     "service_name" : "RANGER",
>     "stale_configs" : false,
>     "state" : "INIT",
>     "upgrade_state" : "NONE",
>     "version" : "UNKNOWN",
>     "actual_configs" : { }
>   },
>   "host" : {
>     "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
>   },
>   "processes" : [ ],
>   "component" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
>       "ServiceComponentInfo" : {
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "service_display_name" : "RANGER",
>         "service_group_name" : "core"
>       }
>     }
>   ]
> }
> {code}
> *DELETE*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "deleteResult" : [
>     {
>       "deleted" : {
>         "key" : "component_name: RANGER_USERSYNC"
>       }
>     }
>   ]
> }
> {code}
> *-----------------------------------------------------------------------------------------------------------------------------------------------------*
> *GET calls once Service, Service Component and Host Components are created:*
> *SERVICE: GET*
>  
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER";,
>   "ServiceInfo" : {
>     "cluster_id" : 2,
>     "cluster_name" : "c1",
>     "credential_store_enabled" : "false",
>     "credential_store_supported" : "false",
>     "desired_repository_version_id" : 1,
>     "desired_stack" : {
>       "stackName" : "HDP",
>       "stackVersion" : "2.6",
>       "stackId" : "HDP-2.6"
>     },
>     "maintenance_state" : "OFF",
>     "repository_state" : "NOT_REQUIRED",
>     "service_display_name" : "RANGER",
>     "service_group_id" : 2,
>     "service_group_name" : "core",
>     "service_id" : 4,
>     "service_name" : "RANGER",
>     "state" : "INIT"
>   },
>   "alerts_summary" : {
>     "CRITICAL" : 0,
>     "MAINTENANCE" : 0,
>     "OK" : 0,
>     "UNKNOWN" : 0,
>     "WARNING" : 0
>   },
>   "alerts" : [ ],
>   "components" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
>       "ServiceComponentInfo" : {
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "service_display_name" : "RANGER",
>         "service_group_name" : "core"
>       }
>     }
>   ],
>   "artifacts" : [ ]
> }
> {code}
> *SERVICE COMPONENT : GET*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
>   "ServiceComponentInfo" : {
>     "category" : "MASTER",
>     "cluster_id" : 2,
>     "cluster_name" : "c1",
>     "component_name" : "RANGER_USERSYNC",
>     "desired_stack" : "HDP-2.6",
>     "desired_version" : "2.6.1.0-129",
>     "display_name" : "Ranger Usersync",
>     "init_count" : 1,
>     "install_failed_count" : 0,
>     "installed_count" : 0,
>     "recovery_enabled" : "false",
>     "repository_state" : "NOT_REQUIRED",
>     "service_display_name" : "RANGER",
>     "service_group_id" : 2,
>     "service_group_name" : "core",
>     "service_id" : 4,
>     "service_name" : "RANGER",
>     "started_count" : 0,
>     "state" : "INIT",
>     "total_count" : 1,
>     "unknown_count" : 0
>   },
>   "host_components" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
>       "HostRoles" : {
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "host_name" : "c6404.ambari.apache.org",
>         "service_display_name" : "RANGER",
>         "service_group_name" : "core"
>       }
>     }
>   ]
> }
> {code}
> *HOST COMPONENT : GET*
> Eg: 
> http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC
> Request
> {code}
> --
> {code}
> Response
> {code}
> {
>   "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org/host_components/RANGER_USERSYNC";,
>   "HostRoles" : {
>     "cluster_id" : 2,
>     "cluster_name" : "c1",
>     "component_name" : "RANGER_USERSYNC",
>     "desired_repository_version" : "2.6.1.0-129",
>     "desired_stack_id" : "HDP-2.6",
>     "desired_state" : "INIT",
>     "display_name" : "Ranger Usersync",
>     "host_name" : "c6404.ambari.apache.org",
>     "id" : 7,
>     "maintenance_state" : "OFF",
>     "public_host_name" : "c6404.ambari.apache.org",
>     "service_display_name" : "RANGER",
>     "service_group_id" : 2,
>     "service_group_name" : "core",
>     "service_id" : 4,
>     "service_name" : "RANGER",
>     "stale_configs" : false,
>     "state" : "INIT",
>     "upgrade_state" : "NONE",
>     "version" : "UNKNOWN",
>     "actual_configs" : { }
>   },
>   "host" : {
>     "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6404.ambari.apache.org";
>   },
>   "component" : [
>     {
>       "href" : 
> "http://c6404.ambari.apache.org:8080/api/v1/clusters/c1/servicegroups/core/services/RANGER/components/RANGER_USERSYNC";,
>       "ServiceComponentInfo" : {
>         "cluster_name" : "c1",
>         "component_name" : "RANGER_USERSYNC",
>         "service_display_name" : "RANGER",
>         "service_group_name" : "core"
>       }
>     }
>   ],
>   "processes" : [ ]
> }
> {code}
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to