Sha256: 4a0fd79a369f6503d8a07db8e4b525498f2131da232c69a9e8447e39838d01b6

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'fog/huaweicloud/models/model'

module Fog
  module Identity
    class HuaweiCloud
      class V3
        class Domain < Fog::HuaweiCloud::Model
          identity :id

          attribute :description
          attribute :enabled
          attribute :name
          attribute :links

          class << self
            attr_accessor :cache
          end

          @cache = {}

          def to_s
            name
          end

          def destroy
            clear_cache
            requires :id
            service.delete_domain(id)
            true
          end

          def update(attr = nil)
            clear_cache
            requires :id, :name
            merge_attributes(
              service.update_domain(id, attr || attributes).body['domain']
            )
            self
          end

          def create
            clear_cache
            requires :name
            merge_attributes(
              service.create_domain(attributes).body['domain']
            )
            self
          end

          private

          def clear_cache
            self.class.cache = {}
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/identity/huaweicloud/v3/models/domain.rb
fog-huaweicloud-0.0.2 lib/fog/identity/huaweicloud/v3/models/domain.rb
fog-huaweicloud-0.1.3 lib/fog/identity/huaweicloud/v3/models/domain.rb
fog-huaweicloud-0.1.2 lib/fog/identity/huaweicloud/v3/models/domain.rb