Module: MgmtConsole::Client::EngageEnvironments

Included in:
MgmtConsole::Client
Defined in:
lib/mgmt_console/client/engage_environments.rb

Overview

Methods for the EngageEnvironmentsAPI

Instance Method Summary collapse

Instance Method Details

#create_engage_environment(name = nil, options = {}) ⇒ Sawyer::Resource

Create Engage Environment

Examples:

Create engage environment

@client.create_engage_environment()

Returns:

  • (Sawyer::Resource)

    Engage Environment

[View source]

21
22
23
24
# File 'lib/mgmt_console/client/engage_environments.rb', line 21

def create_engage_environment(name=nil, options = {})
  params = { :name => name }
  data = post("#{api_endpoint}/engage_environments", options.merge(params))
end

#engage_environments(options = {}) ⇒ Array<Sawyer::Resource>

Get Engage Environments list

Examples:

Get engage environments

@client.engage_environments

Returns:

  • (Array<Sawyer::Resource>)

    Array of engage environments

[View source]

12
13
14
# File 'lib/mgmt_console/client/engage_environments.rb', line 12

def engage_environments(options = {})
  data = get("#{api_endpoint}/engage_environments", options)
end

#update_engage_environment(id = nil, options = {}) ⇒ Sawyer::Resource

Update Engage Environment

Examples:

Update engage environment

@client.update_engage_environment('47d80252-f65e-41bb-b589-7833a1fdd623', only_allow_one_per_cluster: true)

Parameters:

  • id (String) (defaults to: nil)

    Engage Environment ID

Returns:

  • (Sawyer::Resource)

    Engage Environment

Raises:

[View source]

32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mgmt_console/client/engage_environments.rb', line 32

def update_engage_environment(id=nil, options = {})
  raise MgmtConsole::BadRequest.new('You must provide the Engage Environment ID as the first paramater') unless id

  # Optional
  only_allow_one_per_cluster = options.delete(:only_allow_one_per_cluster)

  params = {
    only_allow_one_per_cluster: only_allow_one_per_cluster,
  }.reject { |k,v| v.nil? }

  data = patch("#{api_endpoint}/engage_environments/#{id}", options.merge(params))
end