Class: QingStor::SDK::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/qingstor/sdk/service/qingstor.rb

Overview

QingStor provides QingStor Service API (API Version 2016-01-06)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Service

Returns a new instance of Service.



27
28
29
30
# File 'lib/qingstor/sdk/service/qingstor.rb', line 27

def initialize(config)
  config.check
  self.config = config
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



25
26
27
# File 'lib/qingstor/sdk/service/qingstor.rb', line 25

def config
  @config
end

#propertiesObject

Returns the value of attribute properties.



25
26
27
# File 'lib/qingstor/sdk/service/qingstor.rb', line 25

def properties
  @properties
end

Instance Method Details

#bucket(bucket_name, zone) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/qingstor/sdk/service/qingstor.rb', line 76

def bucket(bucket_name, zone)
  properties = {
    'bucket-name' => bucket_name,
    'zone'        => zone
  }
  Bucket.new(config, properties)
end

#list_buckets(limit: nil, offset: nil, location: '') ⇒ Object

list_buckets: Retrieve the bucket list. Documentation URL: docs.qingcloud.com/qingstor/api/service/get.html



34
35
36
37
38
39
# File 'lib/qingstor/sdk/service/qingstor.rb', line 34

def list_buckets(limit: nil,
                 offset: nil, location: '')
  request = list_buckets_request limit: limit,
    offset: offset, location: location
  request.send
end

#list_buckets_request(limit: nil, offset: nil, location: '') ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/qingstor/sdk/service/qingstor.rb', line 41

def list_buckets_request(limit: nil,
                         offset: nil, location: '')
  input = {
    config:           config,
    api_name:         'Get Service',
    request_method:   'GET',
    request_uri:      '/',
    request_params:   {
      'limit'  => limit,
      'offset' => offset
    },
    request_headers:  {
      'Location' => location
    },
    request_elements: {
    },
    request_body:     nil,

    status_code:      [
      200
    ]
  }

  list_buckets_input_validate input
  Request.new input
end