class Atlas::Client
class: Atlas::Client: The Atlas
Mclient interface
Constants
- DEFAULT_ATLAS_URL
- HEADERS
Public Class Methods
new(user_name, api_key, group_id)
click to toggle source
# File lib/atlas/client.rb, line 16 def initialize(user_name, api_key, group_id) @headers = HEADERS @user_name = user_name @api_key = api_key @peers_endpoint = "#{DEFAULT_ATLAS_URL}/groups/#{group_id}/peers" self end
Public Instance Methods
basic_options()
click to toggle source
# File lib/atlas/client.rb, line 25 def basic_options { headers: @headers, digest_auth: { username: @user_name, password: @api_key } } end
create(data)
click to toggle source
# File lib/atlas/client.rb, line 36 def create(data) call_options = basic_options call_options[:body] = { "vpcId": data.vpc_id, "awsAccountId": data.aws_account_id, "routeTableCidrBlock": data.route_table_cidr_block, "containerId": data.container_id }.to_json HTTParty.post(@peers_endpoint, call_options) end
delete(data)
click to toggle source
# File lib/atlas/client.rb, line 48 def delete(data) HTTParty.delete("#{@peers_endpoint}/#{data.id}", basic_options) end
list(_data = {})
click to toggle source
# File lib/atlas/client.rb, line 32 def list(_data = {}) HTTParty.get(@peers_endpoint, basic_options) end