azure_mgmt_storage 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-05-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  3. data/lib/2015-06-15/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  4. data/lib/2016-01-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  5. data/lib/2016-12-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  6. data/lib/2017-06-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  7. data/lib/2017-10-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  8. data/lib/2018-02-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  9. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  10. data/lib/2018-07-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  11. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  12. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  13. data/lib/2019-06-01/generated/azure_mgmt_storage.rb +51 -40
  14. data/lib/2019-06-01/generated/azure_mgmt_storage/file_shares.rb +156 -14
  15. data/lib/2019-06-01/generated/azure_mgmt_storage/models/blob_restore_range.rb +4 -2
  16. data/lib/2019-06-01/generated/azure_mgmt_storage/models/deleted_share.rb +59 -0
  17. data/lib/2019-06-01/generated/azure_mgmt_storage/models/enabled_protocols.rb +16 -0
  18. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_share.rb +129 -0
  19. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_share_item.rb +129 -0
  20. data/lib/2019-06-01/generated/azure_mgmt_storage/models/get_share_expand.rb +15 -0
  21. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_shares_expand.rb +15 -0
  22. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policies.rb +56 -0
  23. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policy.rb +131 -0
  24. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policy_filter.rb +70 -0
  25. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policy_rule.rb +82 -0
  26. data/lib/2019-06-01/generated/azure_mgmt_storage/models/restore_policy_properties.rb +13 -0
  27. data/lib/2019-06-01/generated/azure_mgmt_storage/models/root_squash_type.rb +17 -0
  28. data/lib/2019-06-01/generated/azure_mgmt_storage/models/share_access_tier.rb +18 -0
  29. data/lib/2019-06-01/generated/azure_mgmt_storage/object_replication_policies_operations.rb +495 -0
  30. data/lib/2019-06-01/generated/azure_mgmt_storage/storage_management_client.rb +6 -1
  31. data/lib/azure_mgmt_storage.rb +10 -10
  32. data/lib/profiles/latest/modules/storage_profile_module.rb +172 -130
  33. data/lib/version.rb +1 -1
  34. metadata +13 -2
@@ -0,0 +1,131 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # The replication policy between two storage accounts. Multiple rules can
10
+ # be defined in one policy.
11
+ #
12
+ class ObjectReplicationPolicy < Resource
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] A unique id for object replication policy.
17
+ attr_accessor :policy_id
18
+
19
+ # @return [DateTime] Indicates when the policy is enabled on the source
20
+ # account.
21
+ attr_accessor :enabled_time
22
+
23
+ # @return [String] Required. Source account name.
24
+ attr_accessor :source_account
25
+
26
+ # @return [String] Required. Destination account name.
27
+ attr_accessor :destination_account
28
+
29
+ # @return [Array<ObjectReplicationPolicyRule>] The storage account object
30
+ # replication rules.
31
+ attr_accessor :rules
32
+
33
+
34
+ #
35
+ # Mapper for ObjectReplicationPolicy class as Ruby Hash.
36
+ # This will be used for serialization/deserialization.
37
+ #
38
+ def self.mapper()
39
+ {
40
+ client_side_validation: true,
41
+ required: false,
42
+ serialized_name: 'ObjectReplicationPolicy',
43
+ type: {
44
+ name: 'Composite',
45
+ class_name: 'ObjectReplicationPolicy',
46
+ model_properties: {
47
+ id: {
48
+ client_side_validation: true,
49
+ required: false,
50
+ read_only: true,
51
+ serialized_name: 'id',
52
+ type: {
53
+ name: 'String'
54
+ }
55
+ },
56
+ name: {
57
+ client_side_validation: true,
58
+ required: false,
59
+ read_only: true,
60
+ serialized_name: 'name',
61
+ type: {
62
+ name: 'String'
63
+ }
64
+ },
65
+ type: {
66
+ client_side_validation: true,
67
+ required: false,
68
+ read_only: true,
69
+ serialized_name: 'type',
70
+ type: {
71
+ name: 'String'
72
+ }
73
+ },
74
+ policy_id: {
75
+ client_side_validation: true,
76
+ required: false,
77
+ read_only: true,
78
+ serialized_name: 'properties.policyId',
79
+ type: {
80
+ name: 'String'
81
+ }
82
+ },
83
+ enabled_time: {
84
+ client_side_validation: true,
85
+ required: false,
86
+ read_only: true,
87
+ serialized_name: 'properties.enabledTime',
88
+ type: {
89
+ name: 'DateTime'
90
+ }
91
+ },
92
+ source_account: {
93
+ client_side_validation: true,
94
+ required: true,
95
+ serialized_name: 'properties.sourceAccount',
96
+ type: {
97
+ name: 'String'
98
+ }
99
+ },
100
+ destination_account: {
101
+ client_side_validation: true,
102
+ required: true,
103
+ serialized_name: 'properties.destinationAccount',
104
+ type: {
105
+ name: 'String'
106
+ }
107
+ },
108
+ rules: {
109
+ client_side_validation: true,
110
+ required: false,
111
+ serialized_name: 'properties.rules',
112
+ type: {
113
+ name: 'Sequence',
114
+ element: {
115
+ client_side_validation: true,
116
+ required: false,
117
+ serialized_name: 'ObjectReplicationPolicyRuleElementType',
118
+ type: {
119
+ name: 'Composite',
120
+ class_name: 'ObjectReplicationPolicyRule'
121
+ }
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ end
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,70 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # Filters limit replication to a subset of blobs within the storage
10
+ # account. A logical OR is performed on values in the filter. If multiple
11
+ # filters are defined, a logical AND is performed on all filters.
12
+ #
13
+ class ObjectReplicationPolicyFilter
14
+
15
+ include MsRestAzure
16
+
17
+ # @return [Array<String>] Optional. Filters the results to replicate only
18
+ # blobs whose names begin with the specified prefix.
19
+ attr_accessor :prefix_match
20
+
21
+ # @return [String] Blobs created after the time will be replicated to the
22
+ # destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'.
23
+ # Example: 2020-02-19T16:05:00Z
24
+ attr_accessor :min_creation_time
25
+
26
+
27
+ #
28
+ # Mapper for ObjectReplicationPolicyFilter class as Ruby Hash.
29
+ # This will be used for serialization/deserialization.
30
+ #
31
+ def self.mapper()
32
+ {
33
+ client_side_validation: true,
34
+ required: false,
35
+ serialized_name: 'ObjectReplicationPolicyFilter',
36
+ type: {
37
+ name: 'Composite',
38
+ class_name: 'ObjectReplicationPolicyFilter',
39
+ model_properties: {
40
+ prefix_match: {
41
+ client_side_validation: true,
42
+ required: false,
43
+ serialized_name: 'prefixMatch',
44
+ type: {
45
+ name: 'Sequence',
46
+ element: {
47
+ client_side_validation: true,
48
+ required: false,
49
+ serialized_name: 'StringElementType',
50
+ type: {
51
+ name: 'String'
52
+ }
53
+ }
54
+ }
55
+ },
56
+ min_creation_time: {
57
+ client_side_validation: true,
58
+ required: false,
59
+ serialized_name: 'minCreationTime',
60
+ type: {
61
+ name: 'String'
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,82 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # The replication policy rule between two containers.
10
+ #
11
+ class ObjectReplicationPolicyRule
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Rule Id is auto-generated for each new rule on
16
+ # destination account. It is required for put policy on source account.
17
+ attr_accessor :rule_id
18
+
19
+ # @return [String] Required. Source container name.
20
+ attr_accessor :source_container
21
+
22
+ # @return [String] Required. Destination container name.
23
+ attr_accessor :destination_container
24
+
25
+ # @return [ObjectReplicationPolicyFilter] Optional. An object that
26
+ # defines the filter set.
27
+ attr_accessor :filters
28
+
29
+
30
+ #
31
+ # Mapper for ObjectReplicationPolicyRule class as Ruby Hash.
32
+ # This will be used for serialization/deserialization.
33
+ #
34
+ def self.mapper()
35
+ {
36
+ client_side_validation: true,
37
+ required: false,
38
+ serialized_name: 'ObjectReplicationPolicyRule',
39
+ type: {
40
+ name: 'Composite',
41
+ class_name: 'ObjectReplicationPolicyRule',
42
+ model_properties: {
43
+ rule_id: {
44
+ client_side_validation: true,
45
+ required: false,
46
+ serialized_name: 'ruleId',
47
+ type: {
48
+ name: 'String'
49
+ }
50
+ },
51
+ source_container: {
52
+ client_side_validation: true,
53
+ required: true,
54
+ serialized_name: 'sourceContainer',
55
+ type: {
56
+ name: 'String'
57
+ }
58
+ },
59
+ destination_container: {
60
+ client_side_validation: true,
61
+ required: true,
62
+ serialized_name: 'destinationContainer',
63
+ type: {
64
+ name: 'String'
65
+ }
66
+ },
67
+ filters: {
68
+ client_side_validation: true,
69
+ required: false,
70
+ serialized_name: 'filters',
71
+ type: {
72
+ name: 'Composite',
73
+ class_name: 'ObjectReplicationPolicyFilter'
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ end
80
+ end
81
+ end
82
+ end
@@ -19,6 +19,10 @@ module Azure::Storage::Mgmt::V2019_06_01
19
19
  # great than zero and less than DeleteRetentionPolicy.days.
20
20
  attr_accessor :days
21
21
 
22
+ # @return [DateTime] Returns the date and time the restore policy was
23
+ # last enabled.
24
+ attr_accessor :last_enabled_time
25
+
22
26
 
23
27
  #
24
28
  # Mapper for RestorePolicyProperties class as Ruby Hash.
@@ -52,6 +56,15 @@ module Azure::Storage::Mgmt::V2019_06_01
52
56
  type: {
53
57
  name: 'Number'
54
58
  }
59
+ },
60
+ last_enabled_time: {
61
+ client_side_validation: true,
62
+ required: false,
63
+ read_only: true,
64
+ serialized_name: 'lastEnabledTime',
65
+ type: {
66
+ name: 'DateTime'
67
+ }
55
68
  }
56
69
  }
57
70
  }
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # Defines values for RootSquashType
10
+ #
11
+ module RootSquashType
12
+ NoRootSquash = "NoRootSquash"
13
+ RootSquash = "RootSquash"
14
+ AllSquash = "AllSquash"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # Defines values for ShareAccessTier
10
+ #
11
+ module ShareAccessTier
12
+ TransactionOptimized = "TransactionOptimized"
13
+ Hot = "Hot"
14
+ Cool = "Cool"
15
+ Premium = "Premium"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,495 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class ObjectReplicationPoliciesOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ObjectReplicationPoliciesOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [StorageManagementClient] reference to the StorageManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List the object replication policies associated with the storage account.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group within the
28
+ # user's subscription. The name is case insensitive.
29
+ # @param account_name [String] The name of the storage account within the
30
+ # specified resource group. Storage account names must be between 3 and 24
31
+ # characters in length and use numbers and lower-case letters only.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [ObjectReplicationPolicies] operation results.
36
+ #
37
+ def list(resource_group_name, account_name, custom_headers:nil)
38
+ response = list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # List the object replication policies associated with the storage account.
44
+ #
45
+ # @param resource_group_name [String] The name of the resource group within the
46
+ # user's subscription. The name is case insensitive.
47
+ # @param account_name [String] The name of the storage account within the
48
+ # specified resource group. Storage account names must be between 3 and 24
49
+ # characters in length and use numbers and lower-case letters only.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(resource_group_name, account_name, custom_headers:nil)
56
+ list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # List the object replication policies associated with the storage account.
61
+ #
62
+ # @param resource_group_name [String] The name of the resource group within the
63
+ # user's subscription. The name is case insensitive.
64
+ # @param account_name [String] The name of the storage account within the
65
+ # specified resource group. Storage account names must be between 3 and 24
66
+ # characters in length and use numbers and lower-case letters only.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_async(resource_group_name, account_name, custom_headers:nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
76
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
77
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
78
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
79
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
84
+
85
+
86
+ request_headers = {}
87
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
88
+
89
+ # Set Headers
90
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
91
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
92
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'
93
+
94
+ request_url = @base_url || @client.base_url
95
+
96
+ options = {
97
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
98
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
99
+ query_params: {'api-version' => @client.api_version},
100
+ headers: request_headers.merge(custom_headers || {}),
101
+ base_url: request_url
102
+ }
103
+ promise = @client.make_request_async(:get, path_template, options)
104
+
105
+ promise = promise.then do |result|
106
+ http_response = result.response
107
+ status_code = http_response.status
108
+ response_content = http_response.body
109
+ unless status_code == 200
110
+ error_model = JSON.load(response_content)
111
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
112
+ end
113
+
114
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
115
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
116
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 200
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicies.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ promise.execute
132
+ end
133
+
134
+ #
135
+ # Get the object replication policy of the storage account by policy ID.
136
+ #
137
+ # @param resource_group_name [String] The name of the resource group within the
138
+ # user's subscription. The name is case insensitive.
139
+ # @param account_name [String] The name of the storage account within the
140
+ # specified resource group. Storage account names must be between 3 and 24
141
+ # characters in length and use numbers and lower-case letters only.
142
+ # @param object_replication_policy_id [String] The ID of object replication
143
+ # policy or 'default' if the policy ID is unknown.
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [ObjectReplicationPolicy] operation results.
148
+ #
149
+ def get(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
150
+ response = get_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
151
+ response.body unless response.nil?
152
+ end
153
+
154
+ #
155
+ # Get the object replication policy of the storage account by policy ID.
156
+ #
157
+ # @param resource_group_name [String] The name of the resource group within the
158
+ # user's subscription. The name is case insensitive.
159
+ # @param account_name [String] The name of the storage account within the
160
+ # specified resource group. Storage account names must be between 3 and 24
161
+ # characters in length and use numbers and lower-case letters only.
162
+ # @param object_replication_policy_id [String] The ID of object replication
163
+ # policy or 'default' if the policy ID is unknown.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
168
+ #
169
+ def get_with_http_info(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
170
+ get_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
171
+ end
172
+
173
+ #
174
+ # Get the object replication policy of the storage account by policy ID.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group within the
177
+ # user's subscription. The name is case insensitive.
178
+ # @param account_name [String] The name of the storage account within the
179
+ # specified resource group. Storage account names must be between 3 and 24
180
+ # characters in length and use numbers and lower-case letters only.
181
+ # @param object_replication_policy_id [String] The ID of object replication
182
+ # policy or 'default' if the policy ID is unknown.
183
+ # @param [Hash{String => String}] A hash of custom headers that will be added
184
+ # to the HTTP request.
185
+ #
186
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
187
+ #
188
+ def get_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
189
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
190
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
191
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
192
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
193
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
194
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
195
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
196
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
197
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
198
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
199
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
200
+ fail ArgumentError, 'object_replication_policy_id is nil' if object_replication_policy_id.nil?
201
+ fail ArgumentError, "'object_replication_policy_id' should satisfy the constraint - 'MinLength': '1'" if !object_replication_policy_id.nil? && object_replication_policy_id.length < 1
202
+
203
+
204
+ request_headers = {}
205
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
206
+
207
+ # Set Headers
208
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
209
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
210
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'
211
+
212
+ request_url = @base_url || @client.base_url
213
+
214
+ options = {
215
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
216
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'objectReplicationPolicyId' => object_replication_policy_id},
217
+ query_params: {'api-version' => @client.api_version},
218
+ headers: request_headers.merge(custom_headers || {}),
219
+ base_url: request_url
220
+ }
221
+ promise = @client.make_request_async(:get, path_template, options)
222
+
223
+ promise = promise.then do |result|
224
+ http_response = result.response
225
+ status_code = http_response.status
226
+ response_content = http_response.body
227
+ unless status_code == 200
228
+ error_model = JSON.load(response_content)
229
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
230
+ end
231
+
232
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
233
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
234
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
235
+ # Deserialize Response
236
+ if status_code == 200
237
+ begin
238
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
239
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicy.mapper()
240
+ result.body = @client.deserialize(result_mapper, parsed_response)
241
+ rescue Exception => e
242
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
243
+ end
244
+ end
245
+
246
+ result
247
+ end
248
+
249
+ promise.execute
250
+ end
251
+
252
+ #
253
+ # Create or update the object replication policy of the storage account.
254
+ #
255
+ # @param resource_group_name [String] The name of the resource group within the
256
+ # user's subscription. The name is case insensitive.
257
+ # @param account_name [String] The name of the storage account within the
258
+ # specified resource group. Storage account names must be between 3 and 24
259
+ # characters in length and use numbers and lower-case letters only.
260
+ # @param object_replication_policy_id [String] The ID of object replication
261
+ # policy or 'default' if the policy ID is unknown.
262
+ # @param properties [ObjectReplicationPolicy] The object replication policy set
263
+ # to a storage account. A unique policy ID will be created if absent.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [ObjectReplicationPolicy] operation results.
268
+ #
269
+ def create_or_update(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:nil)
270
+ response = create_or_update_async(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:custom_headers).value!
271
+ response.body unless response.nil?
272
+ end
273
+
274
+ #
275
+ # Create or update the object replication policy of the storage account.
276
+ #
277
+ # @param resource_group_name [String] The name of the resource group within the
278
+ # user's subscription. The name is case insensitive.
279
+ # @param account_name [String] The name of the storage account within the
280
+ # specified resource group. Storage account names must be between 3 and 24
281
+ # characters in length and use numbers and lower-case letters only.
282
+ # @param object_replication_policy_id [String] The ID of object replication
283
+ # policy or 'default' if the policy ID is unknown.
284
+ # @param properties [ObjectReplicationPolicy] The object replication policy set
285
+ # to a storage account. A unique policy ID will be created if absent.
286
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
287
+ # will be added to the HTTP request.
288
+ #
289
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
290
+ #
291
+ def create_or_update_with_http_info(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:nil)
292
+ create_or_update_async(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:custom_headers).value!
293
+ end
294
+
295
+ #
296
+ # Create or update the object replication policy of the storage account.
297
+ #
298
+ # @param resource_group_name [String] The name of the resource group within the
299
+ # user's subscription. The name is case insensitive.
300
+ # @param account_name [String] The name of the storage account within the
301
+ # specified resource group. Storage account names must be between 3 and 24
302
+ # characters in length and use numbers and lower-case letters only.
303
+ # @param object_replication_policy_id [String] The ID of object replication
304
+ # policy or 'default' if the policy ID is unknown.
305
+ # @param properties [ObjectReplicationPolicy] The object replication policy set
306
+ # to a storage account. A unique policy ID will be created if absent.
307
+ # @param [Hash{String => String}] A hash of custom headers that will be added
308
+ # to the HTTP request.
309
+ #
310
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
311
+ #
312
+ def create_or_update_async(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:nil)
313
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
314
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
315
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
316
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
317
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
318
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
319
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
320
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
321
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
322
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
323
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
324
+ fail ArgumentError, 'object_replication_policy_id is nil' if object_replication_policy_id.nil?
325
+ fail ArgumentError, "'object_replication_policy_id' should satisfy the constraint - 'MinLength': '1'" if !object_replication_policy_id.nil? && object_replication_policy_id.length < 1
326
+ fail ArgumentError, 'properties is nil' if properties.nil?
327
+
328
+
329
+ request_headers = {}
330
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
331
+
332
+ # Set Headers
333
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
334
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
335
+
336
+ # Serialize Request
337
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicy.mapper()
338
+ request_content = @client.serialize(request_mapper, properties)
339
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
340
+
341
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'
342
+
343
+ request_url = @base_url || @client.base_url
344
+
345
+ options = {
346
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
347
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'objectReplicationPolicyId' => object_replication_policy_id},
348
+ query_params: {'api-version' => @client.api_version},
349
+ body: request_content,
350
+ headers: request_headers.merge(custom_headers || {}),
351
+ base_url: request_url
352
+ }
353
+ promise = @client.make_request_async(:put, path_template, options)
354
+
355
+ promise = promise.then do |result|
356
+ http_response = result.response
357
+ status_code = http_response.status
358
+ response_content = http_response.body
359
+ unless status_code == 200
360
+ error_model = JSON.load(response_content)
361
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
362
+ end
363
+
364
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
365
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
366
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
367
+ # Deserialize Response
368
+ if status_code == 200
369
+ begin
370
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
371
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicy.mapper()
372
+ result.body = @client.deserialize(result_mapper, parsed_response)
373
+ rescue Exception => e
374
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
375
+ end
376
+ end
377
+
378
+ result
379
+ end
380
+
381
+ promise.execute
382
+ end
383
+
384
+ #
385
+ # Deletes the object replication policy associated with the specified storage
386
+ # account.
387
+ #
388
+ # @param resource_group_name [String] The name of the resource group within the
389
+ # user's subscription. The name is case insensitive.
390
+ # @param account_name [String] The name of the storage account within the
391
+ # specified resource group. Storage account names must be between 3 and 24
392
+ # characters in length and use numbers and lower-case letters only.
393
+ # @param object_replication_policy_id [String] The ID of object replication
394
+ # policy or 'default' if the policy ID is unknown.
395
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
396
+ # will be added to the HTTP request.
397
+ #
398
+ #
399
+ def delete(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
400
+ response = delete_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
401
+ nil
402
+ end
403
+
404
+ #
405
+ # Deletes the object replication policy associated with the specified storage
406
+ # account.
407
+ #
408
+ # @param resource_group_name [String] The name of the resource group within the
409
+ # user's subscription. The name is case insensitive.
410
+ # @param account_name [String] The name of the storage account within the
411
+ # specified resource group. Storage account names must be between 3 and 24
412
+ # characters in length and use numbers and lower-case letters only.
413
+ # @param object_replication_policy_id [String] The ID of object replication
414
+ # policy or 'default' if the policy ID is unknown.
415
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
416
+ # will be added to the HTTP request.
417
+ #
418
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
419
+ #
420
+ def delete_with_http_info(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
421
+ delete_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
422
+ end
423
+
424
+ #
425
+ # Deletes the object replication policy associated with the specified storage
426
+ # account.
427
+ #
428
+ # @param resource_group_name [String] The name of the resource group within the
429
+ # user's subscription. The name is case insensitive.
430
+ # @param account_name [String] The name of the storage account within the
431
+ # specified resource group. Storage account names must be between 3 and 24
432
+ # characters in length and use numbers and lower-case letters only.
433
+ # @param object_replication_policy_id [String] The ID of object replication
434
+ # policy or 'default' if the policy ID is unknown.
435
+ # @param [Hash{String => String}] A hash of custom headers that will be added
436
+ # to the HTTP request.
437
+ #
438
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
439
+ #
440
+ def delete_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
441
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
442
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
443
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
444
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
445
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
446
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
447
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
448
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
449
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
450
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
451
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
452
+ fail ArgumentError, 'object_replication_policy_id is nil' if object_replication_policy_id.nil?
453
+ fail ArgumentError, "'object_replication_policy_id' should satisfy the constraint - 'MinLength': '1'" if !object_replication_policy_id.nil? && object_replication_policy_id.length < 1
454
+
455
+
456
+ request_headers = {}
457
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
458
+
459
+ # Set Headers
460
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
461
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
462
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'
463
+
464
+ request_url = @base_url || @client.base_url
465
+
466
+ options = {
467
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
468
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'objectReplicationPolicyId' => object_replication_policy_id},
469
+ query_params: {'api-version' => @client.api_version},
470
+ headers: request_headers.merge(custom_headers || {}),
471
+ base_url: request_url
472
+ }
473
+ promise = @client.make_request_async(:delete, path_template, options)
474
+
475
+ promise = promise.then do |result|
476
+ http_response = result.response
477
+ status_code = http_response.status
478
+ response_content = http_response.body
479
+ unless status_code == 200 || status_code == 204
480
+ error_model = JSON.load(response_content)
481
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
482
+ end
483
+
484
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
485
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
486
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
487
+
488
+ result
489
+ end
490
+
491
+ promise.execute
492
+ end
493
+
494
+ end
495
+ end