hpecp.gateway module

class hpecp.gateway.GatewayStatus(value)[source]

Bases: Enum

Bases: enum.Enum

The statuses for a Gateway

Note:

The integer values do not have a meaning outside of this library. The API uses a string identifier with the status name rather than an integer value.

bundle = 1
installing = 2
installed = 3
ready = 4
unlicensed = 5
configuring = 6
configured = 7
error = 8
sysinfo = 9
unconfiguring = 10
deleting = 11
storage_pending = 12
storage_configuring = 13
storage_error = 14
decommission_in_progress = 15
delete_in_progress = 16
class hpecp.gateway.Gateway(json)[source]

Bases: AbstractResource

Create an instance of Gateway from json data returned from the HPE

Container Platform API. Users of this library are not expected to create an instance of this class.

jsonstr

The json returned by the API representing a Gateway.

Gateway

An instance of Gateway

all_fields = ['id', 'hacapable', 'propinfo', 'approved_worker_pubkey', 'schedule', 'ip', 'proxy_nodes_hostname', 'hostname', 'state', 'status_info', 'purpose', 'sysinfo', 'tags']
default_display_fields = ['id', 'ip', 'proxy_nodes_hostname', 'hostname', 'state', 'status_info', 'purpose', 'tags']
property state

@Field: from json[‘state’]

property hacapable

@Field: from json[‘hacapable’]

property propinfo

@Field: from json[‘propinfo’]

property approved_worker_pubkey

@Field: from json[‘approved_worker_pubkey’]

property schedule

@Field: from json[‘schedule’]

property ip

@Field: from json[‘ip’]

property proxy_nodes_hostname

@Field: from json[‘proxy_nodes_hostname’]

property hostname

@Field: from json[‘hostname’]

property purpose

@Field: from json[‘purpose’]

property status_info

@Field: from json[‘status_info’]

property sysinfo

@Field: from json[‘sysinfo’]

property tags

@Field: from json[‘tags’]

class hpecp.gateway.GatewayController(client)[source]

Bases: AbstractWaitableResourceController

Class that users will interact with to work with Gateways. An instance of this class is available in the client.ContainerPlatformClient with the attribute name gateway. The methods of this class can be invoked using client.gateway.method(). See the example below:

>>> client = ContainerPlatformClient(...).create_session()
>>> client.gateway.list()
base_resource_path = '/api/v1/workers'

Declare the resource base path for the API resource.

Getter:

Returns the resource base path

Setter:

Sets the resource base path

Type:

str

class K8sClusterController(AbstractResourceController):

… base_resource_path = “/api/v2/k8scluster”

resource_list_path = 'workers'

Declare the implementing resource list path for the API resource. The resource list path is where the resources are after the ‘_embedded’ element in the API response json.

Getter:

Returns the resource list path

Setter:

Sets the resource list path

Type:

str

class K8sClusterController(AbstractResourceController):

… resource_list_path = “k8sclusters”

resource_class

alias of Gateway

status_class

alias of GatewayStatus

status_fieldname = 'state'

Declare the Status fieldname in the API resource.

Usually either: status or state

Getter:

Returns the Status fieldname

Setter:

Sets the Status fieldname

Type:

str

class K8sClusterController(AbstractResourceController):

… status_fieldname = status

create_with_ssh_key(ip, proxy_node_hostname, ssh_key_data, ssh_passphrase=None, tags=[])[source]

Create a gateway instance using SSH key credentials to access the host.

ip: str

The IP address of the proxy host. Used for internal communication.

proxy_node_hostname: str

Clients will access cluster services will be accessed using this name.

ssh_key_data: str

The ssh key data as a string.

ssh_passphrase: str

The ssh passphrase

tags: list

Tags to use, e.g. “{ ‘tag1’: ‘foo’, ‘tag2’, ‘bar’ }”.

str

gateway ID

get(id)[source]

Retrieve a Gateway by ID.

id: str

The gateway ID - format: ‘/api/v1/workers/[0-9]+’

Gateway

object representing a Gateway

APIException

list()[source]

Make an API call to retrieve a list of Resources.

ResourceList

The ResourceList will contain instances of the class defined by the property self.resource_class

wait_for_state(gateway_id, state=[], timeout_secs=1200)[source]

See wait_for_status().