Sha256: ae887449b79c6d374a9b54f8b10cb10e0da3c01ba03e679100775a5d1dcde600

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

module Fog
  module Brightbox
    class Compute
      class ApiClient < Fog::Brightbox::Model
        identity :id
        attribute :resource_type
        attribute :url

        attribute :name
        attribute :description

        attribute :secret
        attribute :permissions_group

        # Timestamps
        attribute :revoked_at, type: :time

        # Links
        attribute :account_id, aliases: "account", squash: "id"

        def save
          raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
          options = {
            :name => name,
            :description => description,
            :permissions_group => permissions_group
          }.delete_if { |_k, v| v.nil? || v == "" }
          data = service.create_api_client(options)
          merge_attributes(data)
          true
        end

        def destroy
          requires :identity
          service.delete_api_client(identity)
          true
        end

        def reset_secret
          requires :identity
          service.reset_secret_api_client(identity)
          true
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fog-brightbox-1.10.0 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.9.1 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.9.0 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.8.2 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.8.1 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.8.0 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.7.3 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.7.2 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.7.1 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-1.7.0 lib/fog/brightbox/models/compute/api_client.rb