# README
Go API client for client
This Metal Client REST API provides access to bare metal as-a-service (BMaaS) within a single project context. Clients are able to create fully-provisioned hosts, storage volumes, and project-specific private networks in an isolated project environment.
Project-owned resources that can be accessed via this API include - Host, Volume, VolumeAttachment, Network (project private), and SSH Key. Each API call is done within a single project context. The specific Project identifier must be provided within the header of for each REST call. The server will validate that the provided authentication credentials (JWTs) are valid for the referenced project before any operation is performed. If a single credential is valid for multiple projects, the client must still reference a single project in the header for each API call.
Clients can also access information about available services and resources through the AvailableResources object. This object provides detailed information about the OS imaging options, the machine size options, the storage volume options, and data center locations which are needed when creating hosts and volumes.
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: v1
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional
Put the package under your project folder and add the following in import:
import "./client"
Documentation for API Endpoints
All URIs are relative to https://client.greenlake.hpe.com/api/metal/rest/v1
Class | Method | HTTP request | Description |
---|---|---|---|
AllocationApi | GetBySite | Get /allocation/servers | Get servers allocation |
AllocationApi | StorageGetBySite | Get /allocation/storage | Get storage allocation |
AvailableResourcesApi | List | Get /available-resources | Get lists of available resources for creating hosts and volumes |
HostsApi | Add | Post /hosts | Create a new Host |
HostsApi | BootHDD | Post /hosts/{hostId}/boothdd | Set HDD boot order on Host by ID |
HostsApi | BootPXE | Post /hosts/{hostId}/bootpxe | Set PXE boot order on Host by ID |
HostsApi | Delete | Delete /hosts/{hostId} | Delete a Host |
HostsApi | GetByID | Get /hosts/{hostId} | Retrieve Host by ID |
HostsApi | List | Get /hosts | List all Hosts in project |
HostsApi | Maintenance | Post /hosts/{hostId}/maintenance | Do maintenance on a Host by ID |
HostsApi | PowerOff | Post /hosts/{hostId}/poweroff | Power off Host by ID |
HostsApi | PowerOn | Post /hosts/{hostId}/poweron | Power on Host by ID |
HostsApi | PowerReset | Post /hosts/{hostId}/powerreset | Reset Host by ID |
HostsApi | Reimage | Post /hosts/{hostId}/reimage | Reimage Host by ID |
HostsApi | Replace | Post /hosts/{hostId}/replace | Replace Host by ID |
HostsApi | Update | Put /hosts/{hostId} | Update an existing Host |
IppoolsApi | AllocateIPs | Post /ippools/{ippoolId}/allocation | Allocate IPs from the pool |
IppoolsApi | GetByID | Get /ippools/{ippoolId} | Retrieve IP pool by ID |
IppoolsApi | List | Get /ippools | List all ip pools in project |
IppoolsApi | ReturnIPs | Post /ippools/{ippoolId}/return | Return IPs to the pool |
IppoolsApi | Update | Put /ippools/{ippoolId} | Update IP pool by ID |
NetworksApi | Add | Post /networks | Add a new network |
NetworksApi | Delete | Delete /networks/{networkId} | Delete a network |
NetworksApi | GetByID | Get /networks/{networkId} | Retrieve network by ID. |
NetworksApi | List | Get /networks | List all networks in project |
NetworksApi | Update | Put /networks/{networkId} | Update an existing network by ID. |
ProjectsApi | Add | Post /projects | Create a new project |
ProjectsApi | Delete | Delete /projects/{projectId} | Delete a Project |
ProjectsApi | GetByID | Get /projects/{projectId} | Retrieve a project by its ID |
ProjectsApi | List | Get /projects | List of all Projects within an GLCS space or GLP workspace. |
ProjectsApi | Update | Put /projects/{projectId} | Update a project by its ID |
ProjectsInfoApi | List | Get /projects-info | List of all projects info within an organization or cluster for which user is authorized. |
ServicesApi | Add | Post /services | Create a new OS service image |
ServicesApi | Delete | Delete /services/{serviceId} | Delete an OS service image |
ServicesApi | GetByID | Get /services/{serviceId} | Retrieve an OS service image |
ServicesApi | List | Get /services | List of all OS service images within an tenant |
ServicesApi | Update | Put /services/{serviceId} | Update an OS service image by its ID |
SshkeysApi | Add | Post /sshkeys | Add a new SSH Key |
SshkeysApi | Delete | Delete /sshkeys/{sshkeyId} | Delete an SSH key by ID. |
SshkeysApi | GetByID | Get /sshkeys/{sshkeyId} | Retrieve SSH Key by ID |
SshkeysApi | List | Get /sshkeys | List all sshkeys in project |
SshkeysApi | Update | Put /sshkeys/{sshkeyId} | Update an existing SSH Key by ID. |
VersionApi | Get | Get /version | Get api server build version |
VolumeAttachmentsApi | Add | Post /volume-attachments | Create a new VolumeAttachment |
VolumeAttachmentsApi | Delete | Delete /volume-attachments/{attachmentId} | Delete a VolumeAttachment |
VolumeAttachmentsApi | GetByID | Get /volume-attachments/{attachmentId} | Retrieve volume attachment by ID |
VolumeAttachmentsApi | List | Get /volume-attachments | List all volume attachments in project |
VolumesApi | Add | Post /volumes | Add a new volume |
VolumesApi | Attach | Post /volumes/{volumeId}/attach | Attach existing volume to Host |
VolumesApi | Delete | Delete /volumes/{volumeId} | Delete a volume |
VolumesApi | Detach | Post /volumes/{volumeId}/detach | Detach existing volume from Host |
VolumesApi | GetByID | Get /volumes/{volumeId} | Retrieve volume by ID |
VolumesApi | List | Get /volumes | List all volumes in project |
VolumesApi | Update | Put /volumes/{volumeId} | Update an existing volume |
Documentation For Models
- AddVolume
- Algorithm
- Allocation
- AllocationStorage
- AttributeRule
- AvailableImage
- AvailableNetwork
- AvailableResources
- BondMode
- BootMethod
- ClassifierOperator
- Country
- DiskPartitions
- Encoding
- ErrorResponse
- FileInfo
- FlavorDesc
- HealthStatus
- Host
- HostAlertInfo
- HostAllOf
- HostConnection
- HostIscsiConfig
- HostNetworkConnection
- HostPowerState
- HostServerPort
- HostState
- HostSubstate
- IpAllocation
- IpPool
- IpPoolAllOf
- IpPoolStats
- IpRange
- IpSource
- IpVer
- IscsiParameters
- Limits
- LocationInfo
- MachineClassifier
- MachineClassifierRule
- MachineInventory
- MachineSize
- MachineSizeInfo
- MultiPartFile
- Netmask
- Network
- NetworkAllOf
- NetworkHostUse
- NetworkPurpose
- NewHost
- NewIpPool
- NewNetwork
- NewProject
- NewSshKey
- NewVolume
- NewVolumeAttachment
- OpArg
- OpArgType
- OsServiceImage
- OsServiceImageAllOf
- OsServiceImageApproach
- OsServiceImageOrigin
- Partition
- PartitionFormula
- PartitionTable
- PartitionType
- PassedInfo
- Pool
- Profile
- Project
- ProjectAllOf
- ProjectInfo
- ProjectResources
- ProjectsInfo
- ProtocolKind
- ProtocolParameters
- ResourceBase
- ServiceServerInfo
- ServiceStorageInfo
- SshKey
- SshKeyAllOf
- SshKeyEntry
- StorageInventory
- StoragePool
- SummaryInfo
- Target
- Templating
- TemplatingInfo
- UpdateHost
- UpdateHostAllOf
- UpdateHostIscsiConfig
- UpdateIpPool
- UpdateIpPoolAllOf
- UpdateLimits
- UpdateNetwork
- UpdateNetworkAllOf
- UpdateProfile
- UpdateProject
- UpdateProjectAllOf
- UpdateResourceBase
- UpdateSshKey
- UpdateVolume
- UpdateVolumeAllOf
- UseRecord
- UserDefinedSteps
- UserOp
- UserOpEnum
- VaStateEnum
- VafsConfig
- Version
- Volume
- VolumeAllOf
- VolumeAttachHostUuid
- VolumeAttachment
- VolumeAttachmentAllOf
- VolumeCollection
- VolumeFlavor
- VolumeFlavorsInfo
- VolumeInfo
- VolumeState
- VolumeStatus
- VolumeSubState
Documentation For Authorization
BearerAuth
- Type: HTTP basic authentication
Example
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
Membership
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
Project
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)