oraclebmc 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +82 -0
- data/README.md +220 -0
- data/lib/oraclebmc/api_client.rb +349 -0
- data/lib/oraclebmc/config.rb +80 -0
- data/lib/oraclebmc/config_file_loader.rb +85 -0
- data/lib/oraclebmc/core/blockstorage_client.rb +459 -0
- data/lib/oraclebmc/core/compute_client.rb +1053 -0
- data/lib/oraclebmc/core/core.rb +82 -0
- data/lib/oraclebmc/core/models/attach_i_scsi_volume_details.rb +179 -0
- data/lib/oraclebmc/core/models/attach_volume_details.rb +206 -0
- data/lib/oraclebmc/core/models/capture_console_history_details.rb +162 -0
- data/lib/oraclebmc/core/models/console_history.rb +252 -0
- data/lib/oraclebmc/core/models/cpe.rb +209 -0
- data/lib/oraclebmc/core/models/create_cpe_details.rb +187 -0
- data/lib/oraclebmc/core/models/create_dhcp_details.rb +195 -0
- data/lib/oraclebmc/core/models/create_drg_attachment_details.rb +184 -0
- data/lib/oraclebmc/core/models/create_drg_details.rb +173 -0
- data/lib/oraclebmc/core/models/create_image_details.rb +188 -0
- data/lib/oraclebmc/core/models/create_internet_gateway_details.rb +195 -0
- data/lib/oraclebmc/core/models/create_ip_sec_connection_details.rb +210 -0
- data/lib/oraclebmc/core/models/create_route_table_details.rb +195 -0
- data/lib/oraclebmc/core/models/create_security_list_details.rb +206 -0
- data/lib/oraclebmc/core/models/create_subnet_details.rb +253 -0
- data/lib/oraclebmc/core/models/create_vcn_details.rb +187 -0
- data/lib/oraclebmc/core/models/create_volume_backup_details.rb +173 -0
- data/lib/oraclebmc/core/models/create_volume_details.rb +211 -0
- data/lib/oraclebmc/core/models/dhcp_dns_option.rb +203 -0
- data/lib/oraclebmc/core/models/dhcp_option.rb +171 -0
- data/lib/oraclebmc/core/models/dhcp_options.rb +246 -0
- data/lib/oraclebmc/core/models/drg.rb +224 -0
- data/lib/oraclebmc/core/models/drg_attachment.rb +246 -0
- data/lib/oraclebmc/core/models/egress_security_rule.rb +240 -0
- data/lib/oraclebmc/core/models/i_scsi_volume_attachment.rb +254 -0
- data/lib/oraclebmc/core/models/icmp_options.rb +173 -0
- data/lib/oraclebmc/core/models/image.rb +282 -0
- data/lib/oraclebmc/core/models/ingress_security_rule.rb +240 -0
- data/lib/oraclebmc/core/models/instance.rb +326 -0
- data/lib/oraclebmc/core/models/internet_gateway.rb +248 -0
- data/lib/oraclebmc/core/models/ip_sec_connection.rb +261 -0
- data/lib/oraclebmc/core/models/ip_sec_connection_device_config.rb +195 -0
- data/lib/oraclebmc/core/models/ip_sec_connection_device_status.rb +198 -0
- data/lib/oraclebmc/core/models/launch_instance_details.rb +327 -0
- data/lib/oraclebmc/core/models/port_range.rb +175 -0
- data/lib/oraclebmc/core/models/route_rule.rb +177 -0
- data/lib/oraclebmc/core/models/route_table.rb +246 -0
- data/lib/oraclebmc/core/models/security_list.rb +257 -0
- data/lib/oraclebmc/core/models/shape.rb +164 -0
- data/lib/oraclebmc/core/models/subnet.rb +325 -0
- data/lib/oraclebmc/core/models/tcp_options.rb +177 -0
- data/lib/oraclebmc/core/models/tunnel_config.rb +193 -0
- data/lib/oraclebmc/core/models/tunnel_status.rb +218 -0
- data/lib/oraclebmc/core/models/udp_options.rb +177 -0
- data/lib/oraclebmc/core/models/update_cpe_details.rb +162 -0
- data/lib/oraclebmc/core/models/update_dhcp_details.rb +172 -0
- data/lib/oraclebmc/core/models/update_drg_attachment_details.rb +162 -0
- data/lib/oraclebmc/core/models/update_drg_details.rb +162 -0
- data/lib/oraclebmc/core/models/update_image_details.rb +165 -0
- data/lib/oraclebmc/core/models/update_instance_details.rb +165 -0
- data/lib/oraclebmc/core/models/update_internet_gateway_details.rb +173 -0
- data/lib/oraclebmc/core/models/update_ip_sec_connection_details.rb +162 -0
- data/lib/oraclebmc/core/models/update_route_table_details.rb +173 -0
- data/lib/oraclebmc/core/models/update_security_list_details.rb +184 -0
- data/lib/oraclebmc/core/models/update_subnet_details.rb +162 -0
- data/lib/oraclebmc/core/models/update_vcn_details.rb +162 -0
- data/lib/oraclebmc/core/models/update_volume_backup_details.rb +162 -0
- data/lib/oraclebmc/core/models/update_volume_details.rb +163 -0
- data/lib/oraclebmc/core/models/vcn.rb +272 -0
- data/lib/oraclebmc/core/models/vnic.rb +274 -0
- data/lib/oraclebmc/core/models/vnic_attachment.rb +271 -0
- data/lib/oraclebmc/core/models/volume.rb +249 -0
- data/lib/oraclebmc/core/models/volume_attachment.rb +284 -0
- data/lib/oraclebmc/core/models/volume_backup.rb +273 -0
- data/lib/oraclebmc/core/util.rb +1 -0
- data/lib/oraclebmc/core/virtual_network_client.rb +2263 -0
- data/lib/oraclebmc/errors.rb +62 -0
- data/lib/oraclebmc/global_context.rb +21 -0
- data/lib/oraclebmc/identity/identity.rb +38 -0
- data/lib/oraclebmc/identity/identity_client.rb +1462 -0
- data/lib/oraclebmc/identity/models/add_user_to_group_details.rb +173 -0
- data/lib/oraclebmc/identity/models/api_key.rb +251 -0
- data/lib/oraclebmc/identity/models/availability_domain.rb +173 -0
- data/lib/oraclebmc/identity/models/compartment.rb +251 -0
- data/lib/oraclebmc/identity/models/create_api_key_details.rb +162 -0
- data/lib/oraclebmc/identity/models/create_compartment_details.rb +187 -0
- data/lib/oraclebmc/identity/models/create_group_details.rb +186 -0
- data/lib/oraclebmc/identity/models/create_policy_details.rb +215 -0
- data/lib/oraclebmc/identity/models/create_swift_password_details.rb +163 -0
- data/lib/oraclebmc/identity/models/create_user_details.rb +186 -0
- data/lib/oraclebmc/identity/models/group.rb +251 -0
- data/lib/oraclebmc/identity/models/policy.rb +277 -0
- data/lib/oraclebmc/identity/models/swift_password.rb +266 -0
- data/lib/oraclebmc/identity/models/ui_password.rb +227 -0
- data/lib/oraclebmc/identity/models/update_compartment_details.rb +162 -0
- data/lib/oraclebmc/identity/models/update_group_details.rb +162 -0
- data/lib/oraclebmc/identity/models/update_policy_details.rb +190 -0
- data/lib/oraclebmc/identity/models/update_state_details.rb +163 -0
- data/lib/oraclebmc/identity/models/update_swift_password_details.rb +162 -0
- data/lib/oraclebmc/identity/models/update_user_details.rb +162 -0
- data/lib/oraclebmc/identity/models/user.rb +257 -0
- data/lib/oraclebmc/identity/models/user_group_membership.rb +249 -0
- data/lib/oraclebmc/identity/util.rb +1 -0
- data/lib/oraclebmc/load_balancer/load_balancer.rb +45 -0
- data/lib/oraclebmc/load_balancer/load_balancer_client.rb +1218 -0
- data/lib/oraclebmc/load_balancer/models/backend.rb +262 -0
- data/lib/oraclebmc/load_balancer/models/backend_details.rb +248 -0
- data/lib/oraclebmc/load_balancer/models/backend_set.rb +211 -0
- data/lib/oraclebmc/load_balancer/models/backend_set_details.rb +197 -0
- data/lib/oraclebmc/load_balancer/models/certificate.rb +209 -0
- data/lib/oraclebmc/load_balancer/models/certificate_details.rb +245 -0
- data/lib/oraclebmc/load_balancer/models/create_backend_details.rb +248 -0
- data/lib/oraclebmc/load_balancer/models/create_backend_set_details.rb +210 -0
- data/lib/oraclebmc/load_balancer/models/create_certificate_details.rb +245 -0
- data/lib/oraclebmc/load_balancer/models/create_listener_details.rb +216 -0
- data/lib/oraclebmc/load_balancer/models/create_load_balancer_details.rb +233 -0
- data/lib/oraclebmc/load_balancer/models/health_checker.rb +265 -0
- data/lib/oraclebmc/load_balancer/models/health_checker_details.rb +264 -0
- data/lib/oraclebmc/load_balancer/models/ip_address.rb +165 -0
- data/lib/oraclebmc/load_balancer/models/listener.rb +216 -0
- data/lib/oraclebmc/load_balancer/models/listener_details.rb +202 -0
- data/lib/oraclebmc/load_balancer/models/load_balancer.rb +296 -0
- data/lib/oraclebmc/load_balancer/models/load_balancer_policy.rb +162 -0
- data/lib/oraclebmc/load_balancer/models/load_balancer_protocol.rb +162 -0
- data/lib/oraclebmc/load_balancer/models/load_balancer_shape.rb +162 -0
- data/lib/oraclebmc/load_balancer/models/ssl_configuration.rb +195 -0
- data/lib/oraclebmc/load_balancer/models/ssl_configuration_details.rb +195 -0
- data/lib/oraclebmc/load_balancer/models/update_backend_details.rb +220 -0
- data/lib/oraclebmc/load_balancer/models/update_backend_set_details.rb +197 -0
- data/lib/oraclebmc/load_balancer/models/update_health_checker_details.rb +263 -0
- data/lib/oraclebmc/load_balancer/models/update_listener_details.rb +202 -0
- data/lib/oraclebmc/load_balancer/models/update_load_balancer_details.rb +165 -0
- data/lib/oraclebmc/load_balancer/models/work_request.rb +269 -0
- data/lib/oraclebmc/load_balancer/models/work_request_error.rb +185 -0
- data/lib/oraclebmc/load_balancer/util.rb +55 -0
- data/lib/oraclebmc/regions.rb +41 -0
- data/lib/oraclebmc/response.rb +86 -0
- data/lib/oraclebmc/signer.rb +119 -0
- data/lib/oraclebmc/version.rb +5 -0
- data/lib/oraclebmc/waiter.rb +111 -0
- data/lib/oraclebmc.rb +20 -0
- metadata +265 -0
@@ -0,0 +1,186 @@
|
|
1
|
+
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module OracleBMC
|
6
|
+
class Identity::Models::CreateUserDetails
|
7
|
+
# The OCID of the tenancy containing the user.
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :compartment_id
|
10
|
+
|
11
|
+
# The name you assign to the user during creation. This is the user's login for the Console.
|
12
|
+
# The name must be unique across all users in the tenancy and cannot be changed.
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :name
|
16
|
+
|
17
|
+
# The description you assign to the user during creation. Does not have to be unique, and it's changeable.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :description
|
20
|
+
|
21
|
+
|
22
|
+
# Initializes the object
|
23
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
24
|
+
def initialize(attributes = {})
|
25
|
+
return unless attributes.is_a?(Hash)
|
26
|
+
|
27
|
+
# convert string to symbol for hash key
|
28
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
29
|
+
|
30
|
+
|
31
|
+
if attributes[:'compartmentId']
|
32
|
+
self.compartment_id = attributes[:'compartmentId']
|
33
|
+
end
|
34
|
+
|
35
|
+
if attributes[:'name']
|
36
|
+
self.name = attributes[:'name']
|
37
|
+
end
|
38
|
+
|
39
|
+
if attributes[:'description']
|
40
|
+
self.description = attributes[:'description']
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
# Checks equality by comparing each attribute.
|
46
|
+
# @param [Object] other_object to be compared
|
47
|
+
def ==(other_object)
|
48
|
+
return true if self.equal?(other_object)
|
49
|
+
self.class == other_object.class &&
|
50
|
+
compartment_id == other_object.compartment_id &&
|
51
|
+
name == other_object.name &&
|
52
|
+
description == other_object.description
|
53
|
+
end
|
54
|
+
|
55
|
+
# @see the `==` method
|
56
|
+
# @param [Object] other_object to be compared
|
57
|
+
def eql?(other_object)
|
58
|
+
self == other_object
|
59
|
+
end
|
60
|
+
|
61
|
+
# Calculates hash code according to all attributes.
|
62
|
+
# @return [Fixnum] Hash code
|
63
|
+
def hash
|
64
|
+
[compartment_id, name, description].hash
|
65
|
+
end
|
66
|
+
|
67
|
+
# Builds the object from hash
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
69
|
+
# @return [Object] Returns the model itself
|
70
|
+
def build_from_hash(attributes)
|
71
|
+
return nil unless attributes.is_a?(Hash)
|
72
|
+
self.class.swagger_types.each_pair do |key, type|
|
73
|
+
if type =~ /^Array<(.*)>/i
|
74
|
+
# check to ensure the input is an array given that the the attribute
|
75
|
+
# is documented as an array but the input is not
|
76
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
77
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
78
|
+
end
|
79
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
80
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
81
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
82
|
+
end
|
83
|
+
|
84
|
+
self
|
85
|
+
end
|
86
|
+
|
87
|
+
# Returns the string representation of the object
|
88
|
+
# @return [String] String presentation of the object
|
89
|
+
def to_s
|
90
|
+
to_hash.to_s
|
91
|
+
end
|
92
|
+
|
93
|
+
# Returns the object in the form of hash
|
94
|
+
# @return [Hash] Returns the object in the form of hash
|
95
|
+
def to_hash
|
96
|
+
hash = {}
|
97
|
+
self.class.attribute_map.each_pair do |attr, param|
|
98
|
+
value = self.send(attr)
|
99
|
+
next if value.nil?
|
100
|
+
hash[param] = _to_hash(value)
|
101
|
+
end
|
102
|
+
hash
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
# Outputs non-array value in the form of hash
|
108
|
+
# For object, use to_hash. Otherwise, just return the value
|
109
|
+
# @param [Object] value Any valid value
|
110
|
+
# @return [Hash] Returns the value in the form of hash
|
111
|
+
def _to_hash(value)
|
112
|
+
if value.is_a?(Array)
|
113
|
+
value.compact.map{ |v| _to_hash(v) }
|
114
|
+
elsif value.is_a?(Hash)
|
115
|
+
{}.tap do |hash|
|
116
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
117
|
+
end
|
118
|
+
elsif value.respond_to? :to_hash
|
119
|
+
value.to_hash
|
120
|
+
else
|
121
|
+
value
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Deserializes the data based on type
|
126
|
+
# @param [String] type Data type
|
127
|
+
# @param [String] value Value to be deserialized
|
128
|
+
# @return [Object] Deserialized data
|
129
|
+
def _deserialize(type, value)
|
130
|
+
case type.to_sym
|
131
|
+
when :DateTime
|
132
|
+
DateTime.parse(value)
|
133
|
+
when :Date
|
134
|
+
Date.parse(value)
|
135
|
+
when :String
|
136
|
+
value.to_s
|
137
|
+
when :Integer
|
138
|
+
value.to_i
|
139
|
+
when :Float
|
140
|
+
value.to_f
|
141
|
+
when :BOOLEAN
|
142
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
143
|
+
true
|
144
|
+
else
|
145
|
+
false
|
146
|
+
end
|
147
|
+
when :Object
|
148
|
+
# generic object (usually a Hash), return directly
|
149
|
+
value
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
153
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
156
|
+
{}.tap do |hash|
|
157
|
+
value.each do |k, v|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
else # model
|
162
|
+
temp_model = OracleBMC.const_get(type.to_s).new
|
163
|
+
temp_model.build_from_hash(value)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
169
|
+
def self.attribute_map
|
170
|
+
{
|
171
|
+
:'compartment_id' => :'compartmentId',
|
172
|
+
:'name' => :'name',
|
173
|
+
:'description' => :'description'
|
174
|
+
}
|
175
|
+
end
|
176
|
+
|
177
|
+
# Attribute type mapping.
|
178
|
+
def self.swagger_types
|
179
|
+
{
|
180
|
+
:'compartment_id' => :'String',
|
181
|
+
:'name' => :'String',
|
182
|
+
:'description' => :'String'
|
183
|
+
}
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
@@ -0,0 +1,251 @@
|
|
1
|
+
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module OracleBMC
|
6
|
+
class Identity::Models::Group
|
7
|
+
|
8
|
+
LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_CREATING = 'CREATING',
|
9
|
+
LIFECYCLE_STATE_ACTIVE = 'ACTIVE',
|
10
|
+
LIFECYCLE_STATE_INACTIVE = 'INACTIVE',
|
11
|
+
LIFECYCLE_STATE_DELETING = 'DELETING',
|
12
|
+
LIFECYCLE_STATE_DELETED = 'DELETED']
|
13
|
+
|
14
|
+
# The OCID of the group.
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The OCID of the tenancy containing the group.
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :compartment_id
|
21
|
+
|
22
|
+
# The name you assign to the group during creation. The name must be unique across all groups in
|
23
|
+
# the tenancy and cannot be changed.
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
# The description you assign to the group. Does not have to be unique, and it's changeable.
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :description
|
31
|
+
|
32
|
+
# Date and time the group was created, in the format defined by RFC3339.
|
33
|
+
#
|
34
|
+
# Example: `2016-08-25T21:10:29.600Z`
|
35
|
+
#
|
36
|
+
# @return [DateTime]
|
37
|
+
attr_accessor :time_created
|
38
|
+
|
39
|
+
# The group's current state. After creating a group, make sure its `lifecycleState` changes from CREATING to
|
40
|
+
# ACTIVE before using it.
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
attr_accessor :lifecycle_state
|
44
|
+
|
45
|
+
# The detailed status of INACTIVE lifecycleState.
|
46
|
+
# @return [Integer]
|
47
|
+
attr_accessor :inactive_status
|
48
|
+
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
+
|
58
|
+
|
59
|
+
if attributes[:'id']
|
60
|
+
self.id = attributes[:'id']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes[:'compartmentId']
|
64
|
+
self.compartment_id = attributes[:'compartmentId']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes[:'name']
|
68
|
+
self.name = attributes[:'name']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes[:'description']
|
72
|
+
self.description = attributes[:'description']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes[:'timeCreated']
|
76
|
+
self.time_created = attributes[:'timeCreated']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes[:'lifecycleState']
|
80
|
+
self.lifecycle_state = attributes[:'lifecycleState']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes[:'inactiveStatus']
|
84
|
+
self.inactive_status = attributes[:'inactiveStatus']
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
# Custom attribute writer method checking allowed values (enum).
|
90
|
+
# @param [Object] lifecycle_state Object to be assigned
|
91
|
+
def lifecycle_state=(lifecycle_state)
|
92
|
+
if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
|
93
|
+
fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
|
94
|
+
end
|
95
|
+
@lifecycle_state = lifecycle_state
|
96
|
+
end
|
97
|
+
|
98
|
+
# Checks equality by comparing each attribute.
|
99
|
+
# @param [Object] other_object to be compared
|
100
|
+
def ==(other_object)
|
101
|
+
return true if self.equal?(other_object)
|
102
|
+
self.class == other_object.class &&
|
103
|
+
id == other_object.id &&
|
104
|
+
compartment_id == other_object.compartment_id &&
|
105
|
+
name == other_object.name &&
|
106
|
+
description == other_object.description &&
|
107
|
+
time_created == other_object.time_created &&
|
108
|
+
lifecycle_state == other_object.lifecycle_state &&
|
109
|
+
inactive_status == other_object.inactive_status
|
110
|
+
end
|
111
|
+
|
112
|
+
# @see the `==` method
|
113
|
+
# @param [Object] other_object to be compared
|
114
|
+
def eql?(other_object)
|
115
|
+
self == other_object
|
116
|
+
end
|
117
|
+
|
118
|
+
# Calculates hash code according to all attributes.
|
119
|
+
# @return [Fixnum] Hash code
|
120
|
+
def hash
|
121
|
+
[id, compartment_id, name, description, time_created, lifecycle_state, inactive_status].hash
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
self.class.swagger_types.each_pair do |key, type|
|
130
|
+
if type =~ /^Array<(.*)>/i
|
131
|
+
# check to ensure the input is an array given that the the attribute
|
132
|
+
# is documented as an array but the input is not
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
135
|
+
end
|
136
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
139
|
+
end
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns the string representation of the object
|
145
|
+
# @return [String] String presentation of the object
|
146
|
+
def to_s
|
147
|
+
to_hash.to_s
|
148
|
+
end
|
149
|
+
|
150
|
+
# Returns the object in the form of hash
|
151
|
+
# @return [Hash] Returns the object in the form of hash
|
152
|
+
def to_hash
|
153
|
+
hash = {}
|
154
|
+
self.class.attribute_map.each_pair do |attr, param|
|
155
|
+
value = self.send(attr)
|
156
|
+
next if value.nil?
|
157
|
+
hash[param] = _to_hash(value)
|
158
|
+
end
|
159
|
+
hash
|
160
|
+
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
# Outputs non-array value in the form of hash
|
165
|
+
# For object, use to_hash. Otherwise, just return the value
|
166
|
+
# @param [Object] value Any valid value
|
167
|
+
# @return [Hash] Returns the value in the form of hash
|
168
|
+
def _to_hash(value)
|
169
|
+
if value.is_a?(Array)
|
170
|
+
value.compact.map{ |v| _to_hash(v) }
|
171
|
+
elsif value.is_a?(Hash)
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
174
|
+
end
|
175
|
+
elsif value.respond_to? :to_hash
|
176
|
+
value.to_hash
|
177
|
+
else
|
178
|
+
value
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Deserializes the data based on type
|
183
|
+
# @param [String] type Data type
|
184
|
+
# @param [String] value Value to be deserialized
|
185
|
+
# @return [Object] Deserialized data
|
186
|
+
def _deserialize(type, value)
|
187
|
+
case type.to_sym
|
188
|
+
when :DateTime
|
189
|
+
DateTime.parse(value)
|
190
|
+
when :Date
|
191
|
+
Date.parse(value)
|
192
|
+
when :String
|
193
|
+
value.to_s
|
194
|
+
when :Integer
|
195
|
+
value.to_i
|
196
|
+
when :Float
|
197
|
+
value.to_f
|
198
|
+
when :BOOLEAN
|
199
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
200
|
+
true
|
201
|
+
else
|
202
|
+
false
|
203
|
+
end
|
204
|
+
when :Object
|
205
|
+
# generic object (usually a Hash), return directly
|
206
|
+
value
|
207
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
208
|
+
inner_type = Regexp.last_match[:inner_type]
|
209
|
+
value.map { |v| _deserialize(inner_type, v) }
|
210
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
211
|
+
k_type = Regexp.last_match[:k_type]
|
212
|
+
v_type = Regexp.last_match[:v_type]
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each do |k, v|
|
215
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
else # model
|
219
|
+
temp_model = OracleBMC.const_get(type.to_s).new
|
220
|
+
temp_model.build_from_hash(value)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
226
|
+
def self.attribute_map
|
227
|
+
{
|
228
|
+
:'id' => :'id',
|
229
|
+
:'compartment_id' => :'compartmentId',
|
230
|
+
:'name' => :'name',
|
231
|
+
:'description' => :'description',
|
232
|
+
:'time_created' => :'timeCreated',
|
233
|
+
:'lifecycle_state' => :'lifecycleState',
|
234
|
+
:'inactive_status' => :'inactiveStatus'
|
235
|
+
}
|
236
|
+
end
|
237
|
+
|
238
|
+
# Attribute type mapping.
|
239
|
+
def self.swagger_types
|
240
|
+
{
|
241
|
+
:'id' => :'String',
|
242
|
+
:'compartment_id' => :'String',
|
243
|
+
:'name' => :'String',
|
244
|
+
:'description' => :'String',
|
245
|
+
:'time_created' => :'DateTime',
|
246
|
+
:'lifecycle_state' => :'String',
|
247
|
+
:'inactive_status' => :'Integer'
|
248
|
+
}
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
@@ -0,0 +1,277 @@
|
|
1
|
+
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module OracleBMC
|
6
|
+
class Identity::Models::Policy
|
7
|
+
|
8
|
+
LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_CREATING = 'CREATING',
|
9
|
+
LIFECYCLE_STATE_ACTIVE = 'ACTIVE',
|
10
|
+
LIFECYCLE_STATE_INACTIVE = 'INACTIVE',
|
11
|
+
LIFECYCLE_STATE_DELETING = 'DELETING',
|
12
|
+
LIFECYCLE_STATE_DELETED = 'DELETED']
|
13
|
+
|
14
|
+
# The OCID of the policy.
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The OCID of the compartment containing the policy (either the tenancy or another compartment).
|
19
|
+
#
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :compartment_id
|
22
|
+
|
23
|
+
# The name you assign to the policy during creation. The name must be unique across all policies
|
24
|
+
# in the tenancy and cannot be changed.
|
25
|
+
#
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :name
|
28
|
+
|
29
|
+
# An array of one or more policy statements written in the policy language.
|
30
|
+
# @return [Array<String>]
|
31
|
+
attr_accessor :statements
|
32
|
+
|
33
|
+
# The description you assign to the policy. Does not have to be unique, and it's changeable.
|
34
|
+
# @return [String]
|
35
|
+
attr_accessor :description
|
36
|
+
|
37
|
+
# Date and time the policy was created, in the format defined by RFC3339.
|
38
|
+
#
|
39
|
+
# Example: `2016-08-25T21:10:29.600Z`
|
40
|
+
#
|
41
|
+
# @return [DateTime]
|
42
|
+
attr_accessor :time_created
|
43
|
+
|
44
|
+
# The policy's current state. After creating a policy, make sure its `lifecycleState` changes from CREATING to
|
45
|
+
# ACTIVE before using it.
|
46
|
+
#
|
47
|
+
# @return [String]
|
48
|
+
attr_accessor :lifecycle_state
|
49
|
+
|
50
|
+
# The detailed status of INACTIVE lifecycleState.
|
51
|
+
# @return [Integer]
|
52
|
+
attr_accessor :inactive_status
|
53
|
+
|
54
|
+
# The version of the policy. If null or set to an empty string, when a request comes in for authorization, the
|
55
|
+
# policy will be evaluated according to the current behavior of the services at that moment. If set to a particular
|
56
|
+
# date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date.
|
57
|
+
#
|
58
|
+
# @return [DateTime]
|
59
|
+
attr_accessor :version_date
|
60
|
+
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
return unless attributes.is_a?(Hash)
|
66
|
+
|
67
|
+
# convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
69
|
+
|
70
|
+
|
71
|
+
if attributes[:'id']
|
72
|
+
self.id = attributes[:'id']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes[:'compartmentId']
|
76
|
+
self.compartment_id = attributes[:'compartmentId']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes[:'name']
|
80
|
+
self.name = attributes[:'name']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes[:'statements']
|
84
|
+
self.statements = attributes[:'statements']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes[:'description']
|
88
|
+
self.description = attributes[:'description']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes[:'timeCreated']
|
92
|
+
self.time_created = attributes[:'timeCreated']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes[:'lifecycleState']
|
96
|
+
self.lifecycle_state = attributes[:'lifecycleState']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes[:'inactiveStatus']
|
100
|
+
self.inactive_status = attributes[:'inactiveStatus']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes[:'versionDate']
|
104
|
+
self.version_date = attributes[:'versionDate']
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
# Custom attribute writer method checking allowed values (enum).
|
110
|
+
# @param [Object] lifecycle_state Object to be assigned
|
111
|
+
def lifecycle_state=(lifecycle_state)
|
112
|
+
if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
|
113
|
+
fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
|
114
|
+
end
|
115
|
+
@lifecycle_state = lifecycle_state
|
116
|
+
end
|
117
|
+
|
118
|
+
# Checks equality by comparing each attribute.
|
119
|
+
# @param [Object] other_object to be compared
|
120
|
+
def ==(other_object)
|
121
|
+
return true if self.equal?(other_object)
|
122
|
+
self.class == other_object.class &&
|
123
|
+
id == other_object.id &&
|
124
|
+
compartment_id == other_object.compartment_id &&
|
125
|
+
name == other_object.name &&
|
126
|
+
statements == other_object.statements &&
|
127
|
+
description == other_object.description &&
|
128
|
+
time_created == other_object.time_created &&
|
129
|
+
lifecycle_state == other_object.lifecycle_state &&
|
130
|
+
inactive_status == other_object.inactive_status &&
|
131
|
+
version_date == other_object.version_date
|
132
|
+
end
|
133
|
+
|
134
|
+
# @see the `==` method
|
135
|
+
# @param [Object] other_object to be compared
|
136
|
+
def eql?(other_object)
|
137
|
+
self == other_object
|
138
|
+
end
|
139
|
+
|
140
|
+
# Calculates hash code according to all attributes.
|
141
|
+
# @return [Fixnum] Hash code
|
142
|
+
def hash
|
143
|
+
[id, compartment_id, name, statements, description, time_created, lifecycle_state, inactive_status, version_date].hash
|
144
|
+
end
|
145
|
+
|
146
|
+
# Builds the object from hash
|
147
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
148
|
+
# @return [Object] Returns the model itself
|
149
|
+
def build_from_hash(attributes)
|
150
|
+
return nil unless attributes.is_a?(Hash)
|
151
|
+
self.class.swagger_types.each_pair do |key, type|
|
152
|
+
if type =~ /^Array<(.*)>/i
|
153
|
+
# check to ensure the input is an array given that the the attribute
|
154
|
+
# is documented as an array but the input is not
|
155
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
156
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
157
|
+
end
|
158
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
159
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
160
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
161
|
+
end
|
162
|
+
|
163
|
+
self
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the object in the form of hash
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_hash
|
175
|
+
hash = {}
|
176
|
+
self.class.attribute_map.each_pair do |attr, param|
|
177
|
+
value = self.send(attr)
|
178
|
+
next if value.nil?
|
179
|
+
hash[param] = _to_hash(value)
|
180
|
+
end
|
181
|
+
hash
|
182
|
+
end
|
183
|
+
|
184
|
+
private
|
185
|
+
|
186
|
+
# Outputs non-array value in the form of hash
|
187
|
+
# For object, use to_hash. Otherwise, just return the value
|
188
|
+
# @param [Object] value Any valid value
|
189
|
+
# @return [Hash] Returns the value in the form of hash
|
190
|
+
def _to_hash(value)
|
191
|
+
if value.is_a?(Array)
|
192
|
+
value.compact.map{ |v| _to_hash(v) }
|
193
|
+
elsif value.is_a?(Hash)
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
196
|
+
end
|
197
|
+
elsif value.respond_to? :to_hash
|
198
|
+
value.to_hash
|
199
|
+
else
|
200
|
+
value
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Deserializes the data based on type
|
205
|
+
# @param [String] type Data type
|
206
|
+
# @param [String] value Value to be deserialized
|
207
|
+
# @return [Object] Deserialized data
|
208
|
+
def _deserialize(type, value)
|
209
|
+
case type.to_sym
|
210
|
+
when :DateTime
|
211
|
+
DateTime.parse(value)
|
212
|
+
when :Date
|
213
|
+
Date.parse(value)
|
214
|
+
when :String
|
215
|
+
value.to_s
|
216
|
+
when :Integer
|
217
|
+
value.to_i
|
218
|
+
when :Float
|
219
|
+
value.to_f
|
220
|
+
when :BOOLEAN
|
221
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
222
|
+
true
|
223
|
+
else
|
224
|
+
false
|
225
|
+
end
|
226
|
+
when :Object
|
227
|
+
# generic object (usually a Hash), return directly
|
228
|
+
value
|
229
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
230
|
+
inner_type = Regexp.last_match[:inner_type]
|
231
|
+
value.map { |v| _deserialize(inner_type, v) }
|
232
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
233
|
+
k_type = Regexp.last_match[:k_type]
|
234
|
+
v_type = Regexp.last_match[:v_type]
|
235
|
+
{}.tap do |hash|
|
236
|
+
value.each do |k, v|
|
237
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
else # model
|
241
|
+
temp_model = OracleBMC.const_get(type.to_s).new
|
242
|
+
temp_model.build_from_hash(value)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
248
|
+
def self.attribute_map
|
249
|
+
{
|
250
|
+
:'id' => :'id',
|
251
|
+
:'compartment_id' => :'compartmentId',
|
252
|
+
:'name' => :'name',
|
253
|
+
:'statements' => :'statements',
|
254
|
+
:'description' => :'description',
|
255
|
+
:'time_created' => :'timeCreated',
|
256
|
+
:'lifecycle_state' => :'lifecycleState',
|
257
|
+
:'inactive_status' => :'inactiveStatus',
|
258
|
+
:'version_date' => :'versionDate'
|
259
|
+
}
|
260
|
+
end
|
261
|
+
|
262
|
+
# Attribute type mapping.
|
263
|
+
def self.swagger_types
|
264
|
+
{
|
265
|
+
:'id' => :'String',
|
266
|
+
:'compartment_id' => :'String',
|
267
|
+
:'name' => :'String',
|
268
|
+
:'statements' => :'Array<String>',
|
269
|
+
:'description' => :'String',
|
270
|
+
:'time_created' => :'DateTime',
|
271
|
+
:'lifecycle_state' => :'String',
|
272
|
+
:'inactive_status' => :'Integer',
|
273
|
+
:'version_date' => :'DateTime'
|
274
|
+
}
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|