Sha256: 13fb523e1f594c68b6a02a75982b6455542d5f3f3590f1e8c52e88a4e29fac87

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

module Fog
  module Network
    class AzureRM
      # Express Route Circuit Authorization model class for Network Service
      class ExpressRouteCircuitAuthorization < Fog::Model
        identity :name
        attribute :id
        attribute :resource_group
        attribute :authorization_name
        attribute :authorization_key
        attribute :authorization_use_status
        attribute :provisioning_state
        attribute :etag
        attribute :circuit_name

        def self.parse(circuit_authorization)
          circuit_auth_hash = get_hash_from_object(circuit_authorization)
          circuit_auth_hash['resource_group'] = get_resource_group_from_id(circuit_authorization.id)
          circuit_auth_hash['circuit_name'] = get_circuit_name_from_id(circuit_authorization.id)
          circuit_auth_hash
        end

        def save
          requires :name, :resource_group, :circuit_name
          circuit_authorization = service.create_or_update_express_route_circuit_authorization(express_route_circuit_authorization_params)
          merge_attributes(ExpressRouteCircuitAuthorization.parse(circuit_authorization))
        end

        def destroy
          service.delete_express_route_circuit_authorization(resource_group, circuit_name, name)
        end

        private

        def express_route_circuit_authorization_params
          {
            name: name,
            resource_group: resource_group,
            circuit_name: circuit_name,
            authorization_name: authorization_name,
            authorization_key: authorization_key,
            authorization_use_status: authorization_use_status,
            provisioning_state: provisioning_state,
            etag: etag
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.0 lib/fog/azurerm/models/network/express_route_circuit_authorization.rb
fog-azure-rm-0.0.9 lib/fog/azurerm/models/network/express_route_circuit_authorization.rb