Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/fog/aliyun/compute.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

module Fog
module Compute
class Aliyun < Fog::Service
module Aliyun
class Compute < Fog::Service
recognizes :aliyun_url,
:aliyun_accesskey_id,
:aliyun_accesskey_secret,
Expand Down Expand Up @@ -313,7 +313,7 @@ def request(params)
rescue Excon::Errors::HTTPStatusError => error
raise case error
when Excon::Errors::NotFound
Fog::Compute::Aliyun::NotFound.slurp(error)
Fog::Aliyun::Compute::NotFound.slurp(error)
else
error
end
Expand All @@ -336,7 +336,7 @@ def VPCrequest(params)
rescue Excon::Errors::HTTPStatusError => error
raise case error
when Excon::Errors::NotFound
Fog::Compute::Aliyun::NotFound.slurp(error)
Fog::Aliyun::Compute::NotFound.slurp(error)
else
error
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aliyun/models/compute/eip_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require 'fog/core/model'
module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class EipAddress < Fog::Model
identity :id, aliases: 'AllocationId'

Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/eip_addresses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
require 'fog/aliyun/models/compute/eip_address'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class EipAddresses < Fog::Collection
model Fog::Compute::Aliyun::EipAddress
model Fog::Aliyun::Compute::EipAddress

def all(filters_arg = {})
data = Fog::JSON.decode(service.list_eip_addresses(filters_arg).body)['EipAddresses']['EipAddress']
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aliyun/models/compute/flavor.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'fog/core/model'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Flavor < Fog::Model
attribute :base_line_credit, aliases: 'BaseLineCredit'
attribute :cpu_core_count, aliases: 'CpuCoreCount'
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/flavors.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Flavors < Fog::Collection
model Fog::Compute::Aliyun::Flavor
model Fog::Aliyun::Compute::Flavor
def all
data = Fog::JSON.decode(service.list_server_types.body)['InstanceTypes']['InstanceType']
load(data)
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require 'fog/core/model'
module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Image < Fog::Model
identity :id, aliases: 'ImageId'

Expand Down Expand Up @@ -56,7 +56,7 @@ def ready?

def snapshot
requires :snapshot_id
Fog::Compute::Aliyun::Snapshots.new(service: service).all(snapshotIds: [snapshot_id])[0]
Fog::Aliyun::Compute::Snapshots.new(service: service).all(snapshotIds: [snapshot_id])[0]
end

private
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
require 'fog/aliyun/models/compute/image'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Images < Fog::Collection
model Fog::Compute::Aliyun::Image
model Fog::Aliyun::Compute::Image

def all(filters_arg = {})
unless filters_arg.is_a?(Hash)
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aliyun/models/compute/route_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require 'fog/core/model'
module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class RouteEntry < Fog::Model
# "RouteTables"=>{"RouteTable"=>[
# {"CreationTime"=>"2015-08-03T11:23:35Z", "RouteEntrys"=>{"RouteEntry"=>[
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/route_entrys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
require 'fog/aliyun/models/compute/route_entry'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class RouteEntrys < Fog::Collection
attribute :route_table

model Fog::Compute::Aliyun::RouteEntry
model Fog::Aliyun::Compute::RouteEntry

def all(options = {})
requires :route_table
Expand Down
8 changes: 4 additions & 4 deletions lib/fog/aliyun/models/compute/route_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require 'fog/core/model'
module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class RouteTable < Fog::Model
# "RouteTables"=>{"RouteTable"=>[
# {"CreationTime"=>"2015-08-03T11:23:35Z", "RouteEntrys"=>{"RouteEntry"=>[
Expand All @@ -17,10 +17,10 @@ class RouteTable < Fog::Model
attribute :created_at, aliases: 'CreationTime'
attribute :type, aliases: 'RouteTableType'
attribute :v_router_id, aliases: 'VRouterId'
# collection Fog::Compute::Aliyun::RouteEntrys
# collection Fog::Aliyun::Compute::RouteEntrys
def route_entrys
@route_entrys ||= begin
Fog::Compute::Aliyun::RouteEntrys.new(
Fog::Aliyun::Compute::RouteEntrys.new(
route_table: self,
service: service
)
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/route_tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
require 'fog/aliyun/models/compute/route_table'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class RouteTables < Fog::Collection
attribute :v_router

model Fog::Compute::Aliyun::RouteTable
model Fog::Aliyun::Compute::RouteTable

def all(options = {})
requires :v_router
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aliyun/models/compute/security_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require 'fog/core/model'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class SecurityGroup < Fog::Model
identity :id, aliases: 'SecurityGroupId'
attribute :name, aliases: 'SecurityGroupName'
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aliyun/models/compute/security_group_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require 'fog/core/model'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class SecurityGroupRule < Fog::Model
attribute :security_group_id, aliases: 'SecurityGroupId'
attribute :source_cidr_ip, aliases: 'SourceCidrIp'
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/security_group_rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
require 'fog/aliyun/models/compute/security_group_rule'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class SecurityGroupRules < Fog::Collection
model Fog::Compute::Aliyun::SecurityGroupRule
model Fog::Aliyun::Compute::SecurityGroupRule
attribute :security_group_id

def get(security_group_id, options = {})
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/security_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
require 'fog/aliyun/models/compute/security_group'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class SecurityGroups < Fog::Collection
model Fog::Compute::Aliyun::SecurityGroup
model Fog::Aliyun::Compute::SecurityGroup

def all(options = {})
data = Fog::JSON.decode(service.list_security_groups(options).body)['SecurityGroups']['SecurityGroup']
Expand Down
8 changes: 4 additions & 4 deletions lib/fog/aliyun/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require 'fog/compute/models/server'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Server < Fog::Compute::Server
identity :id, aliases: 'InstanceId'
attribute :image_id, aliases: 'ImageId'
Expand Down Expand Up @@ -40,12 +40,12 @@ class Server < Fog::Compute::Server

def image
requires :image_id
Fog::Compute::Aliyun::Image.new(service: service).all(imageId: image_id)[0]
Fog::Aliyun::Compute::Image.new(service: service).all(imageId: image_id)[0]
end

def vpc
requires :vpc_id
$vpc = Fog::Compute::Aliyun::Vpcs.new(service: service).all('vpcId' => vpc_id)[0]
$vpc = Fog::Aliyun::Compute::Vpcs.new(service: service).all('vpcId' => vpc_id)[0]
end

def save(options = {})
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/servers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
require 'fog/aliyun/models/compute/server'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Servers < Fog::Collection
model Fog::Compute::Aliyun::Server
model Fog::Aliyun::Compute::Server

def all(options = {})
data = Fog::JSON.decode(service.list_servers(options).body)['Instances']['Instance']
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require 'fog/core/model'
module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Snapshot < Fog::Model
identity :id, aliases: 'SnapshotId'
attribute :name, aliases: 'SnapshotName'
Expand Down Expand Up @@ -40,7 +40,7 @@ def save(options = {})

def volume
requires :volume_id
Fog::Compute::Aliyun::Volumes.new(service: service).all(diskIds: [volume_id])[0]
Fog::Aliyun::Compute::Volumes.new(service: service).all(diskIds: [volume_id])[0]
end

private
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aliyun/models/compute/snapshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
require 'fog/aliyun/models/compute/snapshot'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Snapshots < Fog::Collection
# attribute :filters
model Fog::Compute::Aliyun::Snapshot
model Fog::Aliyun::Compute::Snapshot

# def initialize(attributes)
# self.filters ||= {}
Expand Down
10 changes: 5 additions & 5 deletions lib/fog/aliyun/models/compute/volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require 'fog/core/model'
module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Volume < Fog::Model
# "ImageId": "",
# "InstanceId": "",
Expand Down Expand Up @@ -75,17 +75,17 @@ def save(options = {})

def image
requires :image_id
Fog::Compute::Aliyun::Images.new(service: service).all(imageId: image_id)[0]
Fog::Aliyun::Compute::Images.new(service: service).all(imageId: image_id)[0]
end

def snapshots
requires :id
Fog::Compute::Aliyun::Snapshots.new(service: service).all(volume_id: id)
Fog::Aliyun::Compute::Snapshots.new(service: service).all(volume_id: id)
end

def source
requires :snapshot_id
Fog::Compute::Aliyun::Snapshots.new(service: service).all(snapshotIds: [snapshot_id])[0]
Fog::Aliyun::Compute::Snapshots.new(service: service).all(snapshotIds: [snapshot_id])[0]
end

private
Expand Down
12 changes: 6 additions & 6 deletions lib/fog/aliyun/models/compute/volumes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
require 'fog/aliyun/models/compute/volume'

module Fog
module Compute
class Aliyun
module Aliyun
class Compute
class Volumes < Fog::Collection
model Fog::Compute::Aliyun::Volume
model Fog::Aliyun::Compute::Volume

# Used to create a volume. There are 3 arguments and availability_zone and size are required. You can generate a new key_pair as follows:
# Aliyun.volumes.create(:size => 10)
Expand Down Expand Up @@ -37,9 +37,9 @@ class Volumes < Fog::Collection
# ==== Returns
#
# >>Aliyun.volumes.all
# <Fog::Compute::Aliyun::Volumes
# <Fog::Aliyun::Compute::Volumes
# [
# <Fog::Compute::Aliyun::Volume
# <Fog::Aliyun::Compute::Volume
# id="d-25ohde62o",
# region_id="cn-beijing",
# zone_id="cn-beijing-a",
Expand Down Expand Up @@ -96,7 +96,7 @@ def all(filters_arg = {})
# ==== Returns
#
# >> Aliyun.volumes.get('d-25ohde62o')
# <Fog::Compute::Aliyun::Volume
# <Fog::Aliyun::Compute::Volume
# id="d-25ohde62o",
# region_id="cn-beijing",
# zone_id="cn-beijing-a",
Expand Down
Loading