Class: PEClient::Resource::NodeClassifierV1::Environments
- Defined in:
- lib/pe_client/resources/node_classifier.v1/environments.rb
Overview
Use the environments endpoints to retrieve the node classifier’s environment data. The responses tell you which environments are available, whether a named environment exists, and which classes exist in a certain environment.
Constant Summary collapse
- BASE_PATH =
The base path for Node Classifier API v1 environments endpoints.
"#{NodeClassifierV1::BASE_PATH}/environments".freeze
Instance Method Summary collapse
-
#classes(environment, name = nil) ⇒ Hash
Retrieve a list of all classes (that the node classifier knows about) or a specific class in a specific environment.
-
#create(name) ⇒ Hash
Create a new environment with a specific name.
-
#get(name = nil) ⇒ Array<Hash>
Retrieve a list of all environments the node classifier knows about at the time of the request.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PEClient::Resource::Base
Instance Method Details
#classes(environment, name = nil) ⇒ Hash
Retrieve a list of all classes (that the node classifier knows about) or a specific class in a specific environment.
61 62 63 64 65 66 67 |
# File 'lib/pe_client/resources/node_classifier.v1/environments.rb', line 61 def classes(environment, name = nil) if name @client.get "#{BASE_PATH}/#{environment}/classes/#{name}" else @client.get "#{BASE_PATH}/#{environment}/classes" end end |
#create(name) ⇒ Hash
Create a new environment with a specific name.
50 51 52 |
# File 'lib/pe_client/resources/node_classifier.v1/environments.rb', line 50 def create(name) @client.put BASE_PATH, body: {name: name} end |
#get(name = nil) ⇒ Array<Hash>
Retrieve a list of all environments the node classifier knows about at the time of the request. Or Retrieve information about a specific environment.
37 38 39 40 41 42 43 |
# File 'lib/pe_client/resources/node_classifier.v1/environments.rb', line 37 def get(name = nil) if name @client.get "#{BASE_PATH}/#{name}" else @client.get BASE_PATH end end |