Sha256: 86dfcdea1274022075d95f4cb407d658444f38826f3d6c836873fbdf399c117a

Contents?: true

Size: 432 Bytes

Versions: 3

Compression:

Stored size: 432 Bytes

Contents

require "ostruct"
require "json"

module Rancher
  module ManagementApi
    class ApiKey < OpenStruct
      def self.create(project, name)
        apikey_response = project.conn.post do |req|
          req.url "/v1/apikey"
          req.body = {
            accountId: project.id,
            name: name,
          }.to_json
        end

        data = JSON.parse(apikey_response.body)
        new(data)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rancher-management_api-0.3.2 lib/rancher/management_api/api_key.rb
rancher-management_api-0.3.0 lib/rancher/management_api/api_key.rb
rancher-management_api-0.2.0 lib/rancher/management_api/api_key.rb