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
# File 'lib/qingstor/sdk/service/qingstor.rb', line 27

def initialize(config)
  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(options = {}) ⇒ Object

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

Options

  • :location - Limits results to buckets that in the location



38
39
40
41
42
# File 'lib/qingstor/sdk/service/qingstor.rb', line 38

def list_buckets(options = {})
  options.deep_stringify_keys!
  request = list_buckets_request options
  request.send
end

#list_buckets_request(options = {}) ⇒ Object



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 44

def list_buckets_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    api_name:         'Get Service',
    request_method:   'GET',
    request_uri:      '/',
    request_params:   {
    },
    request_headers:  {
      'Location' => options['location'],
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  list_buckets_input_validate input
  Request.new input
end