softlayer_api 3.0.0 → 3.0.1

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.
@@ -0,0 +1,144 @@
1
+ #--
2
+ # Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
3
+ #
4
+ # For licensing information see the LICENSE.md file in the project root.
5
+ #++
6
+
7
+ module SoftLayer
8
+ ##
9
+ # Each SoftLayer UserCustomer instance provides information
10
+ # relating to a single SoftLayer customer portal user
11
+ #
12
+ # This class roughly corresponds to the entity SoftLayer_User_Customer
13
+ # in the API.
14
+ #
15
+ class UserCustomer < ModelBase
16
+ include ::SoftLayer::DynamicAttribute
17
+
18
+ ##
19
+ # :attr_reader:
20
+ # A portal user's secondary phone number.
21
+ sl_attr :alternate_phone, 'alternatePhone'
22
+
23
+ ##
24
+ # :attr_reader:
25
+ # The date a portal user's record was created.
26
+ sl_attr :created, 'createDate'
27
+
28
+ ##
29
+ # :attr_reader:
30
+ # The portal user's display name.
31
+ sl_attr :display_name, 'displayName'
32
+
33
+ ##
34
+ # :attr_reader:
35
+ # A portal user's email address.
36
+ sl_attr :email
37
+
38
+ ##
39
+ # :attr_reader:
40
+ # A portal user's first name.
41
+ sl_attr :first_name, 'firstName'
42
+
43
+ ##
44
+ # :attr_reader:
45
+ # A portal user's last name.
46
+ sl_attr :last_name, 'lastName'
47
+
48
+ ##
49
+ # :attr_reader:
50
+ # The date a portal user's record was last modified.
51
+ sl_attr :modified, 'modifyDate'
52
+
53
+ ##
54
+ # :attr_reader:
55
+ # A portal user's office phone number.
56
+ sl_attr :office_phone, 'officePhone'
57
+
58
+ ##
59
+ # :attr_reader:
60
+ # The expiration date for the user's password.
61
+ sl_attr :password_expires, 'passwordExpireDate'
62
+
63
+ ##
64
+ # :attr_reader:
65
+ # The date a portal users record's last status change.
66
+ sl_attr :status_changed, 'statusDate'
67
+
68
+ ##
69
+ # :attr_reader:
70
+ # A portal user's username.
71
+ sl_attr :username
72
+
73
+ ##
74
+ # A portal user's additional email addresses.
75
+ # These email addresses are contacted when updates are made to support tickets.
76
+ sl_dynamic_attr :additional_emails do |resource|
77
+ resource.should_update? do
78
+ #only retrieved once per instance
79
+ @additional_emails == nil
80
+ end
81
+
82
+ resource.to_update do
83
+ additional_emails = self.service.getAdditionalEmails
84
+ additional_emails.collect { |additional_email| additional_email['email'] }
85
+ end
86
+ end
87
+
88
+ ##
89
+ # A portal user's API Authentication keys.
90
+ # There is a max limit of two API keys per user.
91
+ sl_dynamic_attr :api_authentication_keys do |resource|
92
+ resource.should_update? do
93
+ #only retrieved once per instance
94
+ @api_authentication_keys == nil
95
+ end
96
+
97
+ resource.to_update do
98
+ self.service.object_mask("mask[authenticationKey,ipAddressRestriction]").getApiAuthenticationKeys
99
+ end
100
+ end
101
+
102
+ ##
103
+ # The external authentication bindings that link an external identifier to a SoftLayer user.
104
+ sl_dynamic_attr :external_bindings do |resource|
105
+ resource.should_update? do
106
+ #only retrieved once per instance
107
+ @external_bindings == nil
108
+ end
109
+
110
+ resource.to_update do
111
+ external_bindings = self.service.object_mask(UserCustomerExternalBinding.default_object_mask).getExternalBindings
112
+ external_bindings.collect { |external_binding| UserCustomerExternalBinding.new(soflayer_client, external_binding) }
113
+ end
114
+ end
115
+
116
+ ##
117
+ # Returns the service for interacting with this user customer through the network API
118
+ #
119
+ def service
120
+ softlayer_client[:User_Customer].object_with_id(self.id)
121
+ end
122
+
123
+ protected
124
+
125
+ def self.default_object_mask
126
+ {
127
+ "mask(SoftLayer_User_Customer)" => [
128
+ 'alternatePhone',
129
+ 'createDate',
130
+ 'displayName',
131
+ 'email',
132
+ 'firstName',
133
+ 'id',
134
+ 'lastName',
135
+ 'modifyDate',
136
+ 'officePhone',
137
+ 'passwordExpireDate',
138
+ 'statusDate',
139
+ 'username'
140
+ ]
141
+ }.to_sl_object_mask
142
+ end
143
+ end
144
+ end #SoftLayer
@@ -0,0 +1,97 @@
1
+ #--
2
+ # Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
3
+ #
4
+ # For licensing information see the LICENSE.md file in the project root.
5
+ #++
6
+
7
+ module SoftLayer
8
+ ##
9
+ # Each SoftLayer UserCustomerExternalBinding instance provides information
10
+ # for a single user customer's external binding.
11
+ #
12
+ # This class roughly corresponds to the entity SoftLayer_User_Customer_External_Binding
13
+ # in the API.
14
+ #
15
+ class UserCustomerExternalBinding < ModelBase
16
+ include ::SoftLayer::DynamicAttribute
17
+
18
+ ##
19
+ # :attr_reader:
20
+ # The flag that determines whether the external binding is active will be
21
+ # used for authentication or not.
22
+ sl_attr :active
23
+
24
+ ##
25
+ # :attr_reader:
26
+ # The date that the external authentication binding was created.
27
+ sl_attr :created, 'createDate'
28
+
29
+ ##
30
+ # :attr_reader:
31
+ # The password used to authenticate the external id at an external
32
+ # authentication source.
33
+ sl_attr :password
34
+
35
+ ##
36
+ # An optional note for identifying the external binding.
37
+ sl_dynamic_attr :note do |resource|
38
+ resource.should_update? do
39
+ #only retrieved once per instance
40
+ @note == nil
41
+ end
42
+
43
+ resource.to_update do
44
+ self.service.getNote
45
+ end
46
+ end
47
+
48
+ ##
49
+ # The user friendly name of a type of external authentication binding.
50
+ sl_dynamic_attr :type do |resource|
51
+ resource.should_update? do
52
+ #only retrieved once per instance
53
+ @type == nil
54
+ end
55
+
56
+ resource.to_update do
57
+ type = self.service.getType
58
+ type['name']
59
+ end
60
+ end
61
+
62
+ ##
63
+ # The user friendly name of an external binding vendor.
64
+ sl_dynamic_attr :vendor do |resource|
65
+ resource.should_update? do
66
+ #only retrieved once per instance
67
+ @vendor == nil
68
+ end
69
+
70
+ resource.to_update do
71
+ vendor = self.service.getVendor
72
+ vendor['name']
73
+ end
74
+ end
75
+
76
+ ##
77
+ # Returns the service for interacting with this user customer extnerla binding
78
+ # through the network API
79
+ #
80
+ def service
81
+ softlayer_client[:User_Customer_External_Binding].object_with_id(self.id)
82
+ end
83
+
84
+ protected
85
+
86
+ def self.default_object_mask
87
+ {
88
+ "mask(SoftLayer_User_Customer_External_Binding)" => [
89
+ 'active',
90
+ 'createDate',
91
+ 'id',
92
+ 'password'
93
+ ]
94
+ }.to_sl_object_mask
95
+ end
96
+ end
97
+ end #SoftLayer
@@ -0,0 +1,181 @@
1
+ #--
2
+ # Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
3
+ #
4
+ # For licensing information see the LICENSE.md file in the project root.
5
+ #++
6
+
7
+ module SoftLayer
8
+ ##
9
+ # Each SoftLayer VirtualDiskImage instance provides information about software
10
+ # installed on a specific piece of hardware.
11
+ #
12
+ # This class roughly corresponds to the entity SoftLayer_Virtual_Disk_Image
13
+ # in the API.
14
+ #
15
+ class VirtualDiskImage < ModelBase
16
+ include ::SoftLayer::DynamicAttribute
17
+
18
+ ##
19
+ # :attr_reader:
20
+ # A disk image's size measured in gigabytes.
21
+ sl_attr :capacity
22
+
23
+ ##
24
+ # :attr_reader:
25
+ # A disk image's unique md5 checksum.
26
+ sl_attr :checksum
27
+
28
+ ##
29
+ # :attr_reader:
30
+ # The date a disk image was created.
31
+ sl_attr :created, 'createDate'
32
+
33
+ ##
34
+ # :attr_reader:
35
+ # A brief description of a virtual disk image.
36
+ sl_attr :description
37
+
38
+ ##
39
+ # :attr_reader:
40
+ # The date a disk image was last modified.
41
+ sl_attr :modified, 'modifyDate'
42
+
43
+ ##
44
+ # :attr_reader:
45
+ # A descriptive name used to identify a disk image to a user.
46
+ sl_attr :name
47
+
48
+ ##
49
+ # :attr_reader:
50
+ # The unit of storage in which the size of the image is measured.
51
+ # Defaults to "GB" for gigabytes.
52
+ sl_attr :units
53
+
54
+ ##
55
+ # :attr_reader:
56
+ # A disk image's unique ID on a virtualization platform.
57
+ sl_attr :uuid
58
+
59
+ ##
60
+ # Returns coalesced disk images associated with this virtual disk image
61
+ sl_dynamic_attr :coalesced_disk_images do |resource|
62
+ resource.should_update? do
63
+ #only retrieved once per instance
64
+ @coalesced_disk_images == nil
65
+ end
66
+
67
+ resource.to_update do
68
+ coalesced_disk_images = self.service.getCoalescedDiskImages
69
+ coalesced_disk_images.collect { |coalesced_disk_image| VirtualDiskImage.new(softlayer_client, coalesced_disk_image) }
70
+ end
71
+ end
72
+
73
+ ##
74
+ # Returns local disk flag associated with virtual disk image
75
+ sl_dynamic_attr :local_disk do |resource|
76
+ resource.should_update? do
77
+ #only retrieved once per instance
78
+ @local_disk == nil
79
+ end
80
+
81
+ resource.to_update do
82
+ self.service.getLocalDiskFlag
83
+ end
84
+ end
85
+
86
+ ##
87
+ # Whether this disk image is meant for storage of custom user data
88
+ # supplied with a Cloud Computing Instance order.
89
+ sl_dynamic_attr :metadata do |resource|
90
+ resource.should_update? do
91
+ #only retrieved once per instance
92
+ @metadata == nil
93
+ end
94
+
95
+ resource.to_update do
96
+ self.service.getMetadataFlag
97
+ end
98
+ end
99
+
100
+ ##
101
+ # References to the software that resides on a disk image.
102
+ sl_dynamic_attr :software do |resource|
103
+ resource.should_update? do
104
+ #only retrieved once per instance
105
+ @software == nil
106
+ end
107
+
108
+ resource.to_update do
109
+ software_references = self.service.object_mask(VirtualDiskImageSoftware.default_object_mask).getSoftwareReferences
110
+ software_references.collect { |software| VirtualDiskImageSoftware.new(softlayer_client, software) unless software.empty? }.compact
111
+ end
112
+ end
113
+
114
+ ##
115
+ # The original disk image that the current disk image was cloned from.
116
+ sl_dynamic_attr :source_disk_image do |resource|
117
+ resource.should_update? do
118
+ #only retrieved once per instance
119
+ @source_disk_image == nil
120
+ end
121
+
122
+ resource.to_update do
123
+ source_disk_image = self.service.object_mask(VirtualDiskImage.default_object_mask).getSourceDiskImage
124
+ VirtualDiskImage.new(softlayer_client, source_disk_image) unless source_disk_image.empty?
125
+ end
126
+ end
127
+
128
+ ##
129
+ # A brief description of a virtual disk image type's function.
130
+ sl_dynamic_attr :type_description do |resource|
131
+ resource.should_update? do
132
+ #only retrieved once per instance
133
+ @type_description == nil
134
+ end
135
+
136
+ resource.to_update do
137
+ type = self.service.getType
138
+ type['description']
139
+ end
140
+ end
141
+
142
+ ##
143
+ # A virtual disk image type's name.
144
+ sl_dynamic_attr :type_name do |resource|
145
+ resource.should_update? do
146
+ #only retrieved once per instance
147
+ @type_name == nil
148
+ end
149
+
150
+ resource.to_update do
151
+ type = self.service.getType
152
+ type['name']
153
+ end
154
+ end
155
+
156
+ ##
157
+ # Returns the service for interacting with this virtual disk image through the network API
158
+ #
159
+ def service
160
+ softlayer_client[:Virtual_Disk_Image].object_with_id(self.id)
161
+ end
162
+
163
+ protected
164
+
165
+ def self.default_object_mask
166
+ {
167
+ "mask(SoftLayer_Virtual_Disk_Image)" => [
168
+ 'capacity',
169
+ 'checksum',
170
+ 'createDate',
171
+ 'description',
172
+ 'id',
173
+ 'modifyDate',
174
+ 'name',
175
+ 'units',
176
+ 'uuid'
177
+ ]
178
+ }.to_sl_object_mask
179
+ end
180
+ end
181
+ end #SoftLayer
@@ -0,0 +1,51 @@
1
+ #--
2
+ # Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
3
+ #
4
+ # For licensing information see the LICENSE.md file in the project root.
5
+ #++
6
+
7
+ module SoftLayer
8
+ ##
9
+ # Each SoftLayer VirtualDiskImageSoftware is a record that connects
10
+ # a computing instance's virtual disk images with software records.
11
+ #
12
+ # This class roughly corresponds to the entity SoftLayer_Virtual_Disk_Image_Software
13
+ # in the API.
14
+ #
15
+ class VirtualDiskImageSoftware < ModelBase
16
+ include ::SoftLayer::DynamicAttribute
17
+
18
+ ##
19
+ # The manufacturer, name and version of a piece of software.
20
+ #
21
+ def description
22
+ self['softwareDescription']['longDescription']
23
+ end
24
+
25
+ ##
26
+ # The name of this specific piece of software.
27
+ #
28
+ def name
29
+ self['softwareDescription']['name']
30
+ end
31
+
32
+ ##
33
+ # The password for this specific virtual disk image software instance.
34
+ #
35
+ def passwords
36
+ self['passwords']
37
+ end
38
+
39
+ protected
40
+
41
+ def self.default_object_mask
42
+ {
43
+ "mask(SoftLayer_Virtual_Disk_Image_Software)" => [
44
+ 'id',
45
+ 'passwords[password,username]',
46
+ 'softwareDescription[longDescription,name]'
47
+ ]
48
+ }.to_sl_object_mask
49
+ end
50
+ end
51
+ end #SoftLayer