azure_mgmt_storage 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.travis.yml +3 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +21 -0
- data/README.md +111 -0
- data/Rakefile +5 -0
- data/azure_mgmt_storage.gemspec +39 -0
- data/lib/azure_mgmt_storage.rb +54 -0
- data/lib/azure_mgmt_storage/models/account_status.rb +16 -0
- data/lib/azure_mgmt_storage/models/account_type.rb +19 -0
- data/lib/azure_mgmt_storage/models/check_name_availability_result.rb +85 -0
- data/lib/azure_mgmt_storage/models/custom_domain.rb +70 -0
- data/lib/azure_mgmt_storage/models/endpoints.rb +77 -0
- data/lib/azure_mgmt_storage/models/key_name.rb +16 -0
- data/lib/azure_mgmt_storage/models/provisioning_state.rb +17 -0
- data/lib/azure_mgmt_storage/models/reason.rb +16 -0
- data/lib/azure_mgmt_storage/models/storage_account.rb +94 -0
- data/lib/azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb +68 -0
- data/lib/azure_mgmt_storage/models/storage_account_create_parameters.rb +94 -0
- data/lib/azure_mgmt_storage/models/storage_account_keys.rb +67 -0
- data/lib/azure_mgmt_storage/models/storage_account_list_result.rb +89 -0
- data/lib/azure_mgmt_storage/models/storage_account_properties.rb +212 -0
- data/lib/azure_mgmt_storage/models/storage_account_properties_create_parameters.rb +63 -0
- data/lib/azure_mgmt_storage/models/storage_account_properties_update_parameters.rb +85 -0
- data/lib/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb +62 -0
- data/lib/azure_mgmt_storage/models/storage_account_update_parameters.rb +94 -0
- data/lib/azure_mgmt_storage/models/usage.rb +101 -0
- data/lib/azure_mgmt_storage/models/usage_list_result.rb +78 -0
- data/lib/azure_mgmt_storage/models/usage_name.rb +67 -0
- data/lib/azure_mgmt_storage/models/usage_unit.rb +20 -0
- data/lib/azure_mgmt_storage/module_definition.rb +6 -0
- data/lib/azure_mgmt_storage/storage_accounts.rb +1105 -0
- data/lib/azure_mgmt_storage/storage_management_client.rb +65 -0
- data/lib/azure_mgmt_storage/usage_operations.rb +111 -0
- data/lib/azure_mgmt_storage/version.rb +6 -0
- metadata +226 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8fac47453e3ad6d2b881f6ac27930b5a53832740
|
4
|
+
data.tar.gz: 07be1c8903032f44238c1c3b2252ea4732143fd7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 37f50b4ed61e1ee3e409e746a0dcf136eb18f8177fe12734f14cb0402fd5dee7d6d728a77a4ca0480a5b8ac4ecc1d32e86b7b13e5ee11e914f2b9436a86778eb
|
7
|
+
data.tar.gz: c452b1be10063ee007196547deb70cdce72dc4eeebe7a920d88334b5992338457b8a662c434e8e071a6ce104e89429d7b5cf3b2b20fd1ee0f974ba97d153cc51
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
source 'https://rubygems.org'
|
6
|
+
|
7
|
+
gemspec
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem 'azure_mgmt_resources', path: '../azure_mgmt_resources'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'rspec'
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Microsoft Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# Intro
|
2
|
+
|
3
|
+
This project provides a Ruby gem for easy access to the Azure ARM Storage API. With this gem you can create/update/list/delete storage accounts. Usage operation aren't supported yet.
|
4
|
+
|
5
|
+
# Supported Ruby Versions
|
6
|
+
|
7
|
+
* Ruby 2+
|
8
|
+
|
9
|
+
Note: x64 Ruby for Windows is known to have some compatibility issues.
|
10
|
+
|
11
|
+
# Getting started
|
12
|
+
|
13
|
+
## Setting up the service principal
|
14
|
+
|
15
|
+
First of all to start interacting with the ARM resources you will need to setup a service principal. Service principal is an Azure application which allows you to authenticate to Azure and access Azure services. The detailed steps of how to setup a service principal can be found in this article: http://aka.ms/cli-service-principal. In the result of setting up service principal you will get tenant id, client id and client secret data.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
install the appropriate gem:
|
20
|
+
|
21
|
+
```
|
22
|
+
gem install azure_mgmt_storage
|
23
|
+
```
|
24
|
+
|
25
|
+
and reference it in your code:
|
26
|
+
|
27
|
+
```Ruby
|
28
|
+
require 'azure_mgmt_storage'
|
29
|
+
```
|
30
|
+
|
31
|
+
After that you should be ready to start using SDK!
|
32
|
+
|
33
|
+
## Authentication
|
34
|
+
|
35
|
+
```Ruby
|
36
|
+
# Create authentication objects
|
37
|
+
token_provider = MsRestAzure::ApplicationTokenProvider.new(tenant_id, client_id, secret)
|
38
|
+
credentials = MsRest::TokenCredentials.new(token_provider)
|
39
|
+
```
|
40
|
+
|
41
|
+
To get tenant_id, client_id and secret for your Azure application visit Azure portal or copy them from the powershell script from the article mentioned above.
|
42
|
+
|
43
|
+
## Creating storage account
|
44
|
+
|
45
|
+
```Ruby
|
46
|
+
# Create a client - a point of access to the API and set the subscription id
|
47
|
+
client = Azure::ARM::Storage::StorageManagementClient.new(credentials)
|
48
|
+
client.subscription_id = subscription_id
|
49
|
+
|
50
|
+
# Create a model for new storage account.
|
51
|
+
properties = Azure::ARM::Storage::Models::StorageAccountPropertiesCreateParameters.new
|
52
|
+
properties.account_type = 'Standard_LRS'
|
53
|
+
|
54
|
+
params = Azure::ARM::Storage::Models::StorageAccountCreateParameters.new
|
55
|
+
params.properties = properties
|
56
|
+
params.location = 'westus'
|
57
|
+
|
58
|
+
promise = client.storage_accounts.create('some_existing_resource_group', 'newstorageaccount', params)
|
59
|
+
```
|
60
|
+
|
61
|
+
The SDK method returns a promise which you can utilize depending on your needs. E.g. if you need to get result immediately via sync blocking call - do the following:
|
62
|
+
|
63
|
+
```Ruby
|
64
|
+
result = promise.value!
|
65
|
+
```
|
66
|
+
|
67
|
+
If you need to follow async flow - provide a block which will be executed in off main thread:
|
68
|
+
|
69
|
+
```Ruby
|
70
|
+
promise = promise.then do |result|
|
71
|
+
# Handle the result
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
In both cases you're returned an instance of MsRestAzure::AzureOperationResponse which contains HTTP requests/response objects and response body. Response body is a deserialized object representing the received information. In case of code above - newly created storage account. To get data from it:
|
76
|
+
|
77
|
+
```Ruby
|
78
|
+
storage_account = result.body
|
79
|
+
|
80
|
+
p storage_account.location
|
81
|
+
p storage_account.properties.account_type
|
82
|
+
```
|
83
|
+
|
84
|
+
Congrats, you've create new storage account. We encourage you to try more stuff and let us know your feedback!
|
85
|
+
For advanced SDK usage please reference to the spec file storage_management_spec.rb.
|
86
|
+
|
87
|
+
# Running tests
|
88
|
+
|
89
|
+
## Adding env variables
|
90
|
+
|
91
|
+
To run the tests you would need to set the following environment variables with your real Azure data:
|
92
|
+
|
93
|
+
* azure_tenant_id
|
94
|
+
* azure_client_id
|
95
|
+
* azure_client_secret
|
96
|
+
* subscription_id
|
97
|
+
|
98
|
+
* run_long_tasks - set this to '1' only if you would like to run time consuming tests like VM creation.
|
99
|
+
|
100
|
+
## Starting tests
|
101
|
+
|
102
|
+
Just run 'rspec' command from the current gem folder.
|
103
|
+
|
104
|
+
# Contribution
|
105
|
+
|
106
|
+
All the SDK code was generated by tool 'AutoRest' - https://github.com/Azure/autorest
|
107
|
+
So if you have found a bug or have an idea for a new feature - suggest, discuss and contribute it into the AutoRest repository. After that SDK maintainers will update the sources and the gem.
|
108
|
+
|
109
|
+
# Provide feedback
|
110
|
+
|
111
|
+
Send email to the azsdkteam@microsoft.com or file new issue in this repository.
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
lib = File.expand_path('../lib', __FILE__)
|
6
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
+
|
8
|
+
require 'azure_mgmt_storage/module_definition'
|
9
|
+
require 'azure_mgmt_storage/version'
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
spec.name = 'azure_mgmt_storage'
|
13
|
+
spec.version = Azure::ARM::Storage::VERSION
|
14
|
+
spec.authors = 'Microsoft Corporation'
|
15
|
+
spec.email = 'azsdkteam@microsoft.com'
|
16
|
+
spec.description = 'Microsoft Azure Storage Management Client Library for Ruby'
|
17
|
+
spec.summary = 'Official ruby client library to consume Microsoft Azure Storage Management services.'
|
18
|
+
spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = 'bin'
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.required_ruby_version = '>= 1.9.3'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.9'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
31
|
+
spec.add_development_dependency 'dotenv', '~> 2'
|
32
|
+
spec.add_development_dependency 'azure_mgmt_resources', '~> 0.1'
|
33
|
+
|
34
|
+
spec.add_runtime_dependency 'json', '~> 1.8'
|
35
|
+
spec.add_runtime_dependency 'concurrent-ruby', ['>= 1.0.0.pre1', '<2']
|
36
|
+
spec.add_runtime_dependency 'faraday', '~> 0.9'
|
37
|
+
spec.add_runtime_dependency 'faraday-cookie_jar', '~> 0.0.6'
|
38
|
+
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.1'
|
39
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
|
7
|
+
require 'uri'
|
8
|
+
require 'cgi'
|
9
|
+
require 'date'
|
10
|
+
require 'json'
|
11
|
+
require 'base64'
|
12
|
+
require 'erb'
|
13
|
+
require 'securerandom'
|
14
|
+
require 'time'
|
15
|
+
require 'timeliness'
|
16
|
+
require 'faraday'
|
17
|
+
require 'faraday-cookie_jar'
|
18
|
+
require 'concurrent'
|
19
|
+
require 'ms_rest'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
require 'azure_mgmt_storage/module_definition'
|
23
|
+
require 'azure_mgmt_storage/version'
|
24
|
+
|
25
|
+
module Azure::ARM::Storage
|
26
|
+
autoload :StorageAccounts, 'azure_mgmt_storage/storage_accounts.rb'
|
27
|
+
autoload :UsageOperations, 'azure_mgmt_storage/usage_operations.rb'
|
28
|
+
autoload :StorageManagementClient, 'azure_mgmt_storage/storage_management_client.rb'
|
29
|
+
|
30
|
+
module Models
|
31
|
+
autoload :StorageAccountCheckNameAvailabilityParameters, 'azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb'
|
32
|
+
autoload :CheckNameAvailabilityResult, 'azure_mgmt_storage/models/check_name_availability_result.rb'
|
33
|
+
autoload :StorageAccountPropertiesCreateParameters, 'azure_mgmt_storage/models/storage_account_properties_create_parameters.rb'
|
34
|
+
autoload :Endpoints, 'azure_mgmt_storage/models/endpoints.rb'
|
35
|
+
autoload :CustomDomain, 'azure_mgmt_storage/models/custom_domain.rb'
|
36
|
+
autoload :StorageAccountProperties, 'azure_mgmt_storage/models/storage_account_properties.rb'
|
37
|
+
autoload :StorageAccountKeys, 'azure_mgmt_storage/models/storage_account_keys.rb'
|
38
|
+
autoload :StorageAccountListResult, 'azure_mgmt_storage/models/storage_account_list_result.rb'
|
39
|
+
autoload :StorageAccountPropertiesUpdateParameters, 'azure_mgmt_storage/models/storage_account_properties_update_parameters.rb'
|
40
|
+
autoload :StorageAccountRegenerateKeyParameters, 'azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb'
|
41
|
+
autoload :UsageName, 'azure_mgmt_storage/models/usage_name.rb'
|
42
|
+
autoload :Usage, 'azure_mgmt_storage/models/usage.rb'
|
43
|
+
autoload :UsageListResult, 'azure_mgmt_storage/models/usage_list_result.rb'
|
44
|
+
autoload :StorageAccountCreateParameters, 'azure_mgmt_storage/models/storage_account_create_parameters.rb'
|
45
|
+
autoload :StorageAccount, 'azure_mgmt_storage/models/storage_account.rb'
|
46
|
+
autoload :StorageAccountUpdateParameters, 'azure_mgmt_storage/models/storage_account_update_parameters.rb'
|
47
|
+
autoload :Reason, 'azure_mgmt_storage/models/reason.rb'
|
48
|
+
autoload :AccountType, 'azure_mgmt_storage/models/account_type.rb'
|
49
|
+
autoload :ProvisioningState, 'azure_mgmt_storage/models/provisioning_state.rb'
|
50
|
+
autoload :AccountStatus, 'azure_mgmt_storage/models/account_status.rb'
|
51
|
+
autoload :KeyName, 'azure_mgmt_storage/models/key_name.rb'
|
52
|
+
autoload :UsageUnit, 'azure_mgmt_storage/models/usage_unit.rb'
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Storage
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for AccountStatus
|
10
|
+
#
|
11
|
+
module AccountStatus
|
12
|
+
Available = "Available"
|
13
|
+
Unavailable = "Unavailable"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Storage
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for AccountType
|
10
|
+
#
|
11
|
+
module AccountType
|
12
|
+
StandardLRS = "Standard_LRS"
|
13
|
+
StandardZRS = "Standard_ZRS"
|
14
|
+
StandardGRS = "Standard_GRS"
|
15
|
+
StandardRAGRS = "Standard_RAGRS"
|
16
|
+
PremiumLRS = "Premium_LRS"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Storage
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# The CheckNameAvailability operation response.
|
10
|
+
#
|
11
|
+
class CheckNameAvailabilityResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Boolean] Gets a boolean value that indicates whether the name
|
16
|
+
# is available for you to use. If true, the name is available. If
|
17
|
+
# false, the name has already been taken or invalid and cannot be used.
|
18
|
+
attr_accessor :name_available
|
19
|
+
|
20
|
+
# @return [Reason] Gets the reason that a storage account name could not
|
21
|
+
# be used. The Reason element is only returned if NameAvailable is
|
22
|
+
# false. Possible values for this property include:
|
23
|
+
# 'AccountNameInvalid', 'AlreadyExists'.
|
24
|
+
attr_accessor :reason
|
25
|
+
|
26
|
+
# @return [String] Gets an error message explaining the Reason value in
|
27
|
+
# more detail.
|
28
|
+
attr_accessor :message
|
29
|
+
|
30
|
+
#
|
31
|
+
# Validate the object. Throws ValidationError if validation fails.
|
32
|
+
#
|
33
|
+
def validate
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Serializes given Model object into Ruby Hash.
|
38
|
+
# @param object Model object to serialize.
|
39
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
40
|
+
#
|
41
|
+
def self.serialize_object(object)
|
42
|
+
object.validate
|
43
|
+
output_object = {}
|
44
|
+
|
45
|
+
serialized_property = object.name_available
|
46
|
+
output_object['nameAvailable'] = serialized_property unless serialized_property.nil?
|
47
|
+
|
48
|
+
serialized_property = object.reason
|
49
|
+
output_object['reason'] = serialized_property unless serialized_property.nil?
|
50
|
+
|
51
|
+
serialized_property = object.message
|
52
|
+
output_object['message'] = serialized_property unless serialized_property.nil?
|
53
|
+
|
54
|
+
output_object
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Deserializes given Ruby Hash into Model object.
|
59
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
60
|
+
# @return [CheckNameAvailabilityResult] Deserialized object.
|
61
|
+
#
|
62
|
+
def self.deserialize_object(object)
|
63
|
+
return if object.nil?
|
64
|
+
output_object = CheckNameAvailabilityResult.new
|
65
|
+
|
66
|
+
deserialized_property = object['nameAvailable']
|
67
|
+
output_object.name_available = deserialized_property
|
68
|
+
|
69
|
+
deserialized_property = object['reason']
|
70
|
+
if (!deserialized_property.nil? && !deserialized_property.empty?)
|
71
|
+
enum_is_valid = Reason.constants.any? { |e| Reason.const_get(e).to_s.downcase == deserialized_property.downcase }
|
72
|
+
fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
|
73
|
+
end
|
74
|
+
output_object.reason = deserialized_property
|
75
|
+
|
76
|
+
deserialized_property = object['message']
|
77
|
+
output_object.message = deserialized_property
|
78
|
+
|
79
|
+
output_object.validate
|
80
|
+
|
81
|
+
output_object
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Storage
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# The custom domain assigned to this storage account. This can be set via
|
10
|
+
# Update.
|
11
|
+
#
|
12
|
+
class CustomDomain
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [String] Gets or sets the custom domain name. Name is the
|
17
|
+
# CNAME source.
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# @return [Boolean] Indicates whether indirect CName validation is
|
21
|
+
# enabled. Default value is false. This should only be set on updates
|
22
|
+
attr_accessor :use_sub_domain
|
23
|
+
|
24
|
+
#
|
25
|
+
# Validate the object. Throws ValidationError if validation fails.
|
26
|
+
#
|
27
|
+
def validate
|
28
|
+
# Nothing to validate
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Serializes given Model object into Ruby Hash.
|
33
|
+
# @param object Model object to serialize.
|
34
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
35
|
+
#
|
36
|
+
def self.serialize_object(object)
|
37
|
+
object.validate
|
38
|
+
output_object = {}
|
39
|
+
|
40
|
+
serialized_property = object.name
|
41
|
+
output_object['name'] = serialized_property unless serialized_property.nil?
|
42
|
+
|
43
|
+
serialized_property = object.use_sub_domain
|
44
|
+
output_object['useSubDomain'] = serialized_property unless serialized_property.nil?
|
45
|
+
|
46
|
+
output_object
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Deserializes given Ruby Hash into Model object.
|
51
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
52
|
+
# @return [CustomDomain] Deserialized object.
|
53
|
+
#
|
54
|
+
def self.deserialize_object(object)
|
55
|
+
return if object.nil?
|
56
|
+
output_object = CustomDomain.new
|
57
|
+
|
58
|
+
deserialized_property = object['name']
|
59
|
+
output_object.name = deserialized_property
|
60
|
+
|
61
|
+
deserialized_property = object['useSubDomain']
|
62
|
+
output_object.use_sub_domain = deserialized_property
|
63
|
+
|
64
|
+
output_object.validate
|
65
|
+
|
66
|
+
output_object
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|