Table Of Contents - Introduction - Authentication - Get a Space ID - Roles and Permissions - Getting Started Guide - Machine Blueprint Creation Example - Cluster Blueprint Creation Example - Cluster Creation Example # Introduction Welcome to the APIs for HPE GreenLake for Private Cloud Enterprise: containers. This document describes the API protocol and available endpoints for the containers service. The containers service APIs are built on HTTP. Our API is RESTful. It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. You can use your favorite HTTP/REST library for your programming language to use the containers service APIs. # Authentication To authenticate with the containers service, you must obtain the access token using either of the following options.
Private Cloud Cluster Owner
(cluster-admin) or Private Cloud Cluster Resource Contributor
(developer) role. 3. Make a REST call to generate the API access token, using the issuer URL, client ID, and client secret from step 1: curl -i -X POST \\ '{issuerUrl}/v1/token' \\ -H 'Content-Type: application/x-www-form-urlencoded' \\ -d 'client_id={clientID}' \\ -d 'client_secret={clientSecret}' \\ -d grant_type=client_credentials \\ -d scope=hpe-tenant
Obtain the access_token
from the response. To authenticate with the containers service API, you can obtain the access token from <a href="https://client.greenlake.hpe.com\" target="_blank"> HPE GreenLake Central <img src="https://raw.githubusercontent.com/grommet/grommet-icons/stable/img/share.svg\" height="12"> . Log into HPE GreenLake Central. Click the <img src="https://raw.githubusercontent.com/grommet/grommet-icons/stable/img/user.svg\"> icon in the top right corner and then click API Access. In the API Access page, click the <img src="https://raw.githubusercontent.com/grommet/grommet-icons/stable/img/clipboard.svg\"> icon to copy the personal access token. > <img src="https://raw.githubusercontent.com/grommet/grommet-icons/stable/img/circle-information.svg\"> INFO: For both the options, the access token lease expires in 15 minutes. # Get a Space ID You must obtain the space ID for the space on which you have access. Use the UI to get the space ID. ![Alt text](./space.png?raw=true "Space") # Roles and Permissions The containers service provides two default roles for customers: Private Cloud Cluster Owner and Private Cloud Cluster Resource Contributor. The Private Cloud Cluster Owner role is for a cluster administrator who gets all the required permissions to execute all the APIs documented in this guide. The Private Cloud Cluster Resource Contributor role is for developers with only selective permissions, so that they can execute only a selected list of APIs. Each API has details about "Required Permissions to access the API" and "Default Roles which can access the API" # Getting Started Guide Our getting started guide will demonstrate a machine blueprint creation, a cluster blueprint creation and then a cluster creation using that cluster blueprint. Here are the set of APIs that you will likely execute: + Sites + Gets all Sites + Machine Providers + Gets all Machine Providers + Machine Blueprints + Create a Machine Blueprint + Cluster Providers + Gets all Cluster Providers + Cluster Blueprints + Creates a Cluster Blueprint + Clusters + Create a Cluster + Get a specific Cluster ## Machine Blueprint Creation Example Use the steps in this section to create a machine blueprint that can be used by the cluster blueprint. ### Step 1 ### Obtain the 'applianceID' for the site on which you want to create a cluster by running the 'Gets all Sites' API. Note the
applianceID
. ### Step 2 ### Get a list of all machine providers for the specified 'applianceID' by running the 'Gets all Machine Providers' API. Make a note of the name
, workerType
, one of the osImages
, one of the computeInstanceTypes
and one of the storageInstanceTypes
. ### Step 3 ### Create a machine blueprint by running the 'Create a Machine Blueprint' API. Designate the machine role as "worker", and in the request body, provide the values that you noted in the previous step. Make note of the 'id' and 'name' values of the machine blueprint. ## Cluster Blueprint Creation Example ### Step 1 ### List all the cluster providers for the specified 'applianceId' by running the 'Gets all Cluster Providers' API. Make note of the name
, one of the kubernetesVersions
and one of the storageClasses
. ### Step 2 ### Create a cluster blueprint by running the Creates a Cluster Blueprint API, and, in the request body, providing the values noted in the previous step. Take note of the 'id' value in the response body. ## Cluster Creation Example ### Step 1 ### Create the cluster by running the 'Creates a Cluster' API. In the response body, observe the details of the newly created cluster. Make note of the 'clusterID' value. ### Step 2 ### Monitor the cluster provisioning state of the specified 'clusterID' by running the Get a specific Cluster
API. After the state turns ready, the cluster is ready for use! ``
This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.
- API version: v1
- Package version: v0.5.37
- Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen
import "github.com/HewlettPackard/hpegl-containers-go-sdk/pkg/mcaasapi"
...
apiUrl := "<actual url>"
accessToken := "<actual token"
cfg := &mcaasapi.Configuration{
BasePath: apiUrl,
DefaultHeader: make(map[string]string),
UserAgent: "hpecli",
}
client = mcaasapi.NewAPIClient(cfg)
ctx = context.WithValue(gocontext.Background(), mcaasapi.ContextAccessToken, accessToken)
myThing, _, err := client.<XYZ>API.<Function>(ctx)
import "./mcaasapi"
All URIs are relative to https://mcaas.us1.greenlake-hpe.com/mcaas
Class | Method | HTTP request | Description |
---|---|---|---|
ClusterBlueprintsApi | V1ClusterblueprintsGet | Get /v1/clusterblueprints | Gets all Cluster Blueprints |
ClusterBlueprintsApi | V1ClusterblueprintsIdDelete | Delete /v1/clusterblueprints/{id} | Delete a Cluster Blueprint |
ClusterBlueprintsApi | V1ClusterblueprintsIdGet | Get /v1/clusterblueprints/{id} | Gets a specific Cluster Blueprint |
ClusterBlueprintsApi | V1ClusterblueprintsPost | Post /v1/clusterblueprints | Creates a Cluster Blueprint |
ClusterProvidersApi | V1AppliancesIdClusterprovidersGet | Get /v1/appliances/{id}/clusterproviders | Gets all Cluster Providers |
ClustersApi | V1ClustersGet | Get /v1/clusters | Gets all Clusters |
ClustersApi | V1ClustersIdDelete | Delete /v1/clusters/{id} | Deletes a Cluster |
ClustersApi | V1ClustersIdGet | Get /v1/clusters/{id} | Get a specific Cluster |
ClustersApi | V1ClustersIdPut | Put /v1/clusters/{id} | Updates a Cluster |
ClustersApi | V1ClustersPost | Post /v1/clusters | Create a Cluster |
KubeConfigApi | V1ClustersIdKubeconfigGet | Get /v1/clusters/{id}/kubeconfig | Gets a kubeconfig for Cluster |
MachineBlueprintsApi | V1MachineblueprintsGet | Get /v1/machineblueprints | Gets all Machine Blueprints |
MachineBlueprintsApi | V1MachineblueprintsIdDelete | Delete /v1/machineblueprints/{id} | Deletes a Machine Blueprint |
MachineBlueprintsApi | V1MachineblueprintsIdGet | Get /v1/machineblueprints/{id} | Gets a specific Machine Blueprint |
MachineBlueprintsApi | V1MachineblueprintsPost | Post /v1/machineblueprints | Create a Machine Blueprint |
MachineProvidersApi | V1AppliancesIdMachineprovidersGet | Get /v1/appliances/{id}/machineproviders | Gets all Machine Providers |
NamespacesApi | V1ClustersIdNamespacesGet | Get /v1/clusters/{id}/namespaces | Gets all Namespaces for Cluster |
SitesApi | V1AppliancesGet | Get /v1/appliances | Gets all Sites |
StorageClassesApi | V1ClustersIdStorageclassesGet | Get /v1/clusters/{id}/storageclasses | Gets all StorageClasses from Cluster |
- AllOfClusterOidc
- AllOfClusterProviderMinMasterSize
- AllOfClusterProviderMinWorkerSize
- AllOfCreateClusterOidc
- AllOfMachineBlueprintSizeDetail
- AllOfMachineSetDetailSizeDetail
- AllOfOidcClaimMapping
- AllOfUpdateClusterOidc
- Appliance
- Appliances
- ClaimMapping
- Cluster
- ClusterBlueprint
- ClusterBlueprints
- ClusterProvider
- ClusterProviderAvailableCapacity
- ClusterProviderLicenseInfo
- ClusterProviders
- ClusterUtilization
- Clusters
- Common
- ComputeInstanceTypes
- CreateCluster
- EmptyBody
- Health
- Kubeconfig
- Licenses
- Machine
- MachineBlueprint
- MachineBlueprints
- MachineProvider
- MachineProviderName
- MachineProviders
- MachineRolesType
- MachineSet
- MachineSetDetail
- MachineWorkerType
- ModelError
- Namespace
- Namespaces
- Oidc
- OsImages
- Pagination
- ResourceQuota
- ServiceEndpoints
- SizeDetail
- State
- StorageClass
- StorageClasses
- UpdateCluster
- UpdateClusterMachineSet
- User