Sha256: d9e61267c48695b6ac04f9fd6edc328266f16f11a2683f4ace9cdd494a066c46

Contents?: true

Size: 745 Bytes

Versions: 16

Compression:

Stored size: 745 Bytes

Contents

require 'conjur/host'

module Conjur
  class API
    class << self
      def enroll_host(url)
        if Conjur.log
          Conjur.log << "Enrolling host with URL #{url}\n"
        end
        require 'uri'
        url = URI.parse(url) if url.is_a?(String)
        response = Net::HTTP.get_response url
        raise "Host enrollment failed with status #{response.code} : #{response.body}" unless response.code.to_i == 200
        mime_type = response['Content-Type']
        body = response.body
        [ mime_type, body ]
      end
    end
    
    def create_host options
      standard_create Conjur::Core::API.host, :host, nil, options
    end
    
    def host id
      standard_show Conjur::Core::API.host, :host, id
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
conjur-api-2.7.1 lib/conjur/api/hosts.rb
conjur-api-2.5.1 lib/conjur/api/hosts.rb
conjur-api-2.4.0 lib/conjur/api/hosts.rb
conjur-api-2.3.1 lib/conjur/api/hosts.rb
conjur-api-2.2.3 lib/conjur/api/hosts.rb
conjur-api-2.2.2 lib/conjur/api/hosts.rb
conjur-api-2.2.1 lib/conjur/api/hosts.rb
conjur-api-2.1.8 lib/conjur/api/hosts.rb
conjur-api-2.1.7 lib/conjur/api/hosts.rb
conjur-api-2.1.6 lib/conjur/api/hosts.rb
conjur-api-2.1.5 lib/conjur/api/hosts.rb
conjur-api-2.1.4 lib/conjur/api/hosts.rb
conjur-api-2.1.3 lib/conjur/api/hosts.rb
conjur-api-2.1.2 lib/conjur/api/hosts.rb
conjur-api-2.1.1 lib/conjur/api/hosts.rb
conjur-api-2.1.0 lib/conjur/api/hosts.rb