croesus 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +121 -0
  3. data/.ruby-version +1 -0
  4. data/API_operation.txt +197 -0
  5. data/CHANGELOG.md +0 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE.txt +0 -0
  8. data/README.md +146 -0
  9. data/Rakefile +26 -0
  10. data/bin/console_cmd.rb +133 -0
  11. data/croesus.gemspec +39 -0
  12. data/lib/croesus/associations.rb +46 -0
  13. data/lib/croesus/attribute.rb +41 -0
  14. data/lib/croesus/attributes.rb +93 -0
  15. data/lib/croesus/coerce.rb +110 -0
  16. data/lib/croesus/coercions/boolean_definitions.rb +32 -0
  17. data/lib/croesus/coercions/date_definitions.rb +30 -0
  18. data/lib/croesus/coercions/date_time_definitions.rb +30 -0
  19. data/lib/croesus/coercions/fixnum_definitions.rb +32 -0
  20. data/lib/croesus/coercions/float_definitions.rb +30 -0
  21. data/lib/croesus/coercions/hash_definitions.rb +27 -0
  22. data/lib/croesus/coercions/integer_definitions.rb +29 -0
  23. data/lib/croesus/coercions/string_definitions.rb +43 -0
  24. data/lib/croesus/coercions/time_definitions.rb +30 -0
  25. data/lib/croesus/core_ext/blank.rb +123 -0
  26. data/lib/croesus/core_ext/hash.rb +185 -0
  27. data/lib/croesus/dsl/dsl.rb +35 -0
  28. data/lib/croesus/dsl/helpers.rb +43 -0
  29. data/lib/croesus/dsl/mod_factory.rb +191 -0
  30. data/lib/croesus/dsl/resource_dsl.rb +59 -0
  31. data/lib/croesus/dsl/route_dsl.rb +42 -0
  32. data/lib/croesus/identity_map.rb +98 -0
  33. data/lib/croesus/platform.rb +47 -0
  34. data/lib/croesus/querying.rb +63 -0
  35. data/lib/croesus/resources/about.rb +15 -0
  36. data/lib/croesus/resources/basic_methods.rb +36 -0
  37. data/lib/croesus/resources/connectivity.rb +42 -0
  38. data/lib/croesus/resources/container.rb +135 -0
  39. data/lib/croesus/resources/fault.rb +38 -0
  40. data/lib/croesus/resources/fault_effect.rb +24 -0
  41. data/lib/croesus/resources/group.rb +37 -0
  42. data/lib/croesus/resources/host.rb +26 -0
  43. data/lib/croesus/resources/job.rb +27 -0
  44. data/lib/croesus/resources/namespace.rb +39 -0
  45. data/lib/croesus/resources/policy.rb +38 -0
  46. data/lib/croesus/resources/source.rb +86 -0
  47. data/lib/croesus/resources/source_config.rb +54 -0
  48. data/lib/croesus/resources/source_environment.rb +58 -0
  49. data/lib/croesus/resources/source_repository.rb +14 -0
  50. data/lib/croesus/resources/system_info.rb +21 -0
  51. data/lib/croesus/resources/timeflow.rb +40 -0
  52. data/lib/croesus/resources/timeflow_snapshot.rb +38 -0
  53. data/lib/croesus/utils.rb +262 -0
  54. data/lib/croesus/validations/many.rb +27 -0
  55. data/lib/croesus/validations/optional.rb +27 -0
  56. data/lib/croesus/validations.rb +91 -0
  57. data/lib/croesus/validators/base.rb +47 -0
  58. data/lib/croesus/validators/boolean_validator.rb +32 -0
  59. data/lib/croesus/validators/email_validator.rb +36 -0
  60. data/lib/croesus/validators/enumerable_validator.rb +40 -0
  61. data/lib/croesus/validators/hash_validator.rb +50 -0
  62. data/lib/croesus/validators/lambda_validator.rb +54 -0
  63. data/lib/croesus/validators/many_validator.rb +57 -0
  64. data/lib/croesus/validators/optional_validator.rb +41 -0
  65. data/lib/croesus/validators/presence_validator.rb +36 -0
  66. data/lib/croesus/validators/simple_type_validators.rb +38 -0
  67. data/lib/croesus/validators/simple_validator.rb +40 -0
  68. data/lib/croesus/version.rb +43 -0
  69. data/lib/croesus/web_client/web_client.rb +153 -0
  70. data/lib/croesus/web_client/web_request.rb +77 -0
  71. data/lib/croesus/web_client/web_response.rb +70 -0
  72. data/lib/croesus.rb +250 -0
  73. metadata +325 -0
@@ -0,0 +1,98 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Author: Stefano Harding <riddopic@gmail.com>
4
+ #
5
+ # Copyright (C) 2014 Stefano Harding
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
+ # implied. See the License for the specific language governing
17
+ # permissions and limitations under the License.
18
+ #
19
+
20
+ module Croesus
21
+ module IdentityMap
22
+ def self.enabled=(flag)
23
+ Thread.current[:identity_map_enabled] = flag
24
+ end
25
+
26
+ def self.enabled
27
+ Thread.current[:identity_map_enabled]
28
+ end
29
+
30
+ def self.enabled?
31
+ enabled == true
32
+ end
33
+
34
+ def self.repository
35
+ Thread.current[:identity_map] ||= {}
36
+ end
37
+
38
+ def self.clear
39
+ repository.clear
40
+ end
41
+
42
+ def self.include?(object)
43
+ repository.keys.include?(object.id)
44
+ end
45
+
46
+ def self.use
47
+ old, self.enabled = enabled, true
48
+
49
+ yield if block_given?
50
+ ensure
51
+ self.enabled = old
52
+ clear
53
+ end
54
+
55
+ def self.without
56
+ old, self.enabled = enabled, false
57
+
58
+ yield if block_given?
59
+ ensure
60
+ self.enabled = old
61
+ end
62
+
63
+ module ClassMethods
64
+ def get(id, options = nil)
65
+ get_from_identity_map(id) || super
66
+ end
67
+
68
+ def get_from_identity_map(id)
69
+ IdentityMap.repository[id] if IdentityMap.enabled?
70
+ end
71
+ private :get_from_identity_map
72
+
73
+ def load(id, attrs)
74
+ if IdentityMap.enabled? && instance = IdentityMap.repository[id]
75
+ instance
76
+ else
77
+ super.tap { |doc| doc.add_to_identity_map }
78
+ end
79
+ end
80
+ end
81
+
82
+ def save(options={})
83
+ super.tap { |result| add_to_identity_map if result }
84
+ end
85
+
86
+ def delete
87
+ super.tap { remove_from_identity_map }
88
+ end
89
+
90
+ def add_to_identity_map
91
+ IdentityMap.repository[id] = self if IdentityMap.enabled?
92
+ end
93
+
94
+ def remove_from_identity_map
95
+ IdentityMap.repository.delete(id) if IdentityMap.enabled?
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Author: Stefano Harding <riddopic@gmail.com>
4
+ #
5
+ # Copyright (C) 2014 Stefano Harding
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
+ # implied. See the License for the specific language governing
17
+ # permissions and limitations under the License.
18
+ #
19
+
20
+ require 'rbconfig'
21
+
22
+ # Gets the current Operating System.
23
+ module OS
24
+ def self.windows?
25
+ windows = /cygwin|mswin|mingw|bccwin|wince|emx/i
26
+
27
+ (RbConfig::CONFIG['host_os'] =~ windows) != nil
28
+ end
29
+
30
+ def self.mac?
31
+ mac = /darwin|mac os/i
32
+
33
+ (RbConfig::CONFIG['host_os'] =~ mac) != nil
34
+ end
35
+
36
+ def self.unix?
37
+ unix = /solaris|bsd/i
38
+
39
+ (RbConfig::CONFIG['host_os'] =~ unix) != nil
40
+ end
41
+
42
+ def self.linux?
43
+ linux = /linux/i
44
+
45
+ (RbConfig::CONFIG['host_os'] =~ linux) != nil
46
+ end
47
+ end
@@ -0,0 +1,63 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Author: Stefano Harding <riddopic@gmail.com>
4
+ #
5
+ # Copyright (C) 2014 Stefano Harding
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
+ # implied. See the License for the specific language governing
17
+ # permissions and limitations under the License.
18
+ #
19
+
20
+ module Croesus
21
+ module Querying
22
+ module ClassMethods
23
+ def read(id, options = nil)
24
+ { id: id, options: options, model: self, hit: false }
25
+ end
26
+ alias_method :get, :read
27
+ alias_method :find, :read
28
+
29
+ def read!(id, options = nil)
30
+ read(id, options) || raise(NotFound.new(id))
31
+ end
32
+ alias_method :get!, :read!
33
+ alias_method :find!, :read!
34
+
35
+ def read_multiple(ids, options = nil)
36
+ { ids: ids, options: options, model: self, hits: 0, misses: 0 }
37
+ end
38
+ alias_method :get_multiple, :read_multiple
39
+ alias_method :find_multiple, :read_multiple
40
+
41
+ def key?(id, options = nil)
42
+ { id: id, options: options, model: self }
43
+ end
44
+ alias :has_key? :key?
45
+
46
+ def load(id, attrs)
47
+ attrs ||= {}
48
+ instance = constant_from_attrs(attrs).allocate
49
+ instance.initialize_from_database(attrs.update('id' => id))
50
+ end
51
+
52
+ def constant_from_attrs(attrs)
53
+ self if attrs.nil?
54
+ type = attrs[:type] || attrs['type']
55
+ self if type.nil?
56
+ type.constantize
57
+ rescue NameError
58
+ self
59
+ end
60
+ private :constant_from_attrs
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,15 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :about do
6
+ description 'Retrieve static system-wide properties.'
7
+ root '/resources/json/delphix/about'
8
+
9
+ get '/resources/json/delphix/about' do
10
+ description 'Retrieve the specified PublicSystemInfo object.'
11
+ returns Array
12
+ name :list
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,36 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Author: Stefano Harding <riddopic@gmail.com>
4
+ #
5
+ # Copyright (C) 2014 Stefano Harding
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
+ # implied. See the License for the specific language governing
17
+ # permissions and limitations under the License.
18
+ #
19
+
20
+ module Croesus::BasicMethods
21
+ def self.included(base)
22
+ base.extend(ClassMethods)
23
+ end
24
+ private_class_method :included
25
+
26
+ module ClassMethods
27
+
28
+ def url(ref: nil, filter: nil, action: nil)
29
+ url = @root
30
+ url = ref.nil? ? url : "#{url}/#{ref}"
31
+ url = filter.nil? ? url : "#{url}/#{filter}"
32
+ url = action.nil? ? url : "#{url}/#{action}"
33
+ Croesus.api_url(url)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,42 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :connectivity do
6
+ description 'Tools to test connectivity of external resources.'
7
+ root '/resources/json/delphix/connectivity'
8
+
9
+ post '/resources/json/delphix/connectivity/connector' do
10
+ description 'Tests whether the specified host is accessible over Delphix ' \
11
+ 'Connector protocol with the provided credentials. This ' \
12
+ 'operates independent of any other objects in the Delphix ' \
13
+ 'system. If the connection attempt is successful, then this ' \
14
+ 'API call will return no data. If there is a problem ' \
15
+ 'connecting to the host, an API error is returned.'
16
+ returns Array
17
+ name :connector
18
+ end
19
+
20
+ post '/resources/json/delphix/connectivity/jdbc' do
21
+ description 'Tests whether the specified database is accessible over JDBC ' \
22
+ 'with the provided credentials. This operates independent of ' \
23
+ 'any other objects in the Delphix system. If the connection ' \
24
+ 'attempt is successful, then this API call will return no ' \
25
+ 'data. If there is a problem connecting to the host, an API ' \
26
+ 'error is returned.'
27
+ returns Array
28
+ name :jdbc
29
+ end
30
+
31
+ post '/resources/json/delphix/connectivity/ssh' do
32
+ description 'Tests whether the specified host is accessible over SSH with ' \
33
+ 'the provided credentials. This operates independent of any ' \
34
+ 'other objects in the Delphix system. If the connection ' \
35
+ 'attempt is successful, then this API call will return no ' \
36
+ 'data. If there is a problem connecting to the host, an API ' \
37
+ 'error is returned.'
38
+ returns Array
39
+ name :ssh
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,135 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :container do
6
+ description 'A container holding data.'
7
+ root '/resources/json/delphix/database'
8
+
9
+ get '/resources/json/delphix/database' do
10
+ description 'Returns a list of databases on the system or within a group.'
11
+ returns Array
12
+ name :list
13
+ end
14
+
15
+ get '/resources/json/delphix/database/{ref}' do
16
+ description 'Retrieve the specified Container object.'
17
+ returns Object
18
+ name :read
19
+ end
20
+
21
+ post '/resources/json/delphix/database/{ref}' do
22
+ description 'Update the specified Container object.'
23
+ input String
24
+ name :update
25
+ end
26
+
27
+ post '/resources/json/delphix/database/{ref}' do
28
+ description 'Delete the specified Container object.'
29
+ input String
30
+ name :delete
31
+ end
32
+
33
+ post '/resources/json/delphix/database/export' do
34
+ description 'Provision a physical database.'
35
+ input String
36
+ name :export
37
+ end
38
+
39
+ post '/resources/json/delphix/database/fileMapping' do
40
+ description 'Generate file mappings for a particular timeflow point and ' \
41
+ 'a set of rules.'
42
+ input String
43
+ name :fileMapping
44
+ end
45
+
46
+ post '/resources/json/delphix/database/link' do
47
+ description 'Links the database specified by link parameters.'
48
+ input String
49
+ name :link
50
+ end
51
+
52
+ post '/resources/json/delphix/database/provision' do
53
+ description 'Provisions the container specified by the provision ' \
54
+ 'parameters.'
55
+ input String
56
+ name :provision
57
+ end
58
+
59
+ post '/resources/json/delphix/database/validateXpp' do
60
+ description 'Validate the container for cross-platform provisioning.'
61
+ input String
62
+ name :validateXpp
63
+ end
64
+
65
+ post '/resources/json/delphix/database/xpp' do
66
+ description 'Provisions the container specified by the provision ' \
67
+ 'parameters to a different host platform.'
68
+ input String
69
+ name :xpp
70
+ end
71
+
72
+ post '/resources/json/delphix/database/{ref}/attachSource' do
73
+ description 'Attaches a database source to a previously detached container.'
74
+ input String
75
+ name :attachSource
76
+ end
77
+
78
+ post '/resources/json/delphix/database/{ref}/connectionInfo' do
79
+ description 'Returns the connection information for the source '\
80
+ 'associated with this container.'
81
+ input String
82
+ name :connectionInfo
83
+ end
84
+
85
+ post '/resources/json/delphix/database/{ref}/detachSource' do
86
+ description 'Detaches a linked source from a database.'
87
+ input String
88
+ name :detachSource
89
+ end
90
+
91
+ post '/resources/json/delphix/database/{ref}/refresh' do
92
+ description 'Refreshes a container.'
93
+ input String
94
+ name :refresh
95
+ end
96
+
97
+ post '/resources/json/delphix/database/{ref}/requestXppUpload' do
98
+ description 'Request upload for cross-platform provisioning. See ' \
99
+ 'UploadParameters for more information on how to upload files.'
100
+ input String
101
+ name :requestXppUpload
102
+ end
103
+
104
+ post '/resources/json/delphix/database/{ref}/rollback' do
105
+ description 'Rolls back a container.'
106
+ input String
107
+ name :rollback
108
+ end
109
+
110
+ post '/resources/json/delphix/database/{ref}/switchTimeflow' do
111
+ description 'Switch to the latest point on the specified TimeFlow.'
112
+ input String
113
+ name :switchTimeflow
114
+ end
115
+
116
+ post '/resources/json/delphix/database/{ref}/sync' do
117
+ description 'Performs SnapSync on a database.'
118
+ input String
119
+ name :sync
120
+ end
121
+
122
+ post '/resources/json/delphix/database/{ref}/testPerformanceModeDataLoss' do
123
+ description 'Test the effect of data loss as might be seen as a result ' \
124
+ 'of a Delphix Engine failure with performanceMode enabled.'
125
+ input String
126
+ name :testPerformanceModeDataLoss
127
+ end
128
+
129
+ get '/resources/json/delphix/database/{ref}/xppStatus' do
130
+ description 'Get the cross-platform provisioning status of this container.'
131
+ input String
132
+ name :xppStatus
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,38 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :fault do
6
+ description 'A representation of a fault, with associated user object.'
7
+ root '/resources/json/delphix/fault'
8
+
9
+ get '/resources/json/delphix/fault' do
10
+ description 'Returns the list of all the faults that match the given ' \
11
+ 'criteria.'
12
+ returns Array
13
+ name :list
14
+ end
15
+
16
+ get '/resources/json/delphix/fault/{ref}' do
17
+ description 'Retrieve the specified Fault object ' \
18
+ 'criteria.'
19
+ returns Array
20
+ name :read
21
+ end
22
+
23
+ post '/resources/json/delphix/fault/{ref}/resolve' do
24
+ description 'Marks the fault as resolved. The system will attempt to ' \
25
+ 'automatically detect cases where the fault has been resolved; '\
26
+ 'but this is not always possible and may only occur on ' \
27
+ 'periodic intervals. In these cases, the user can proactively ' \
28
+ 'mark the fault resolved. This does not change the underlying ' \
29
+ 'disposition of the fault - if the problem is still present ' \
30
+ 'the system may immediately diagnose the same problem again. ' \
31
+ 'This should only be used to notify the system of resolution ' \
32
+ 'after the underlying problem has been resolved.'
33
+ 'criteria.'
34
+ returns Array
35
+ name :resolve
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :fault_effect do
6
+ description 'An error affecting a user object whose root cause is a ' \
7
+ 'fault. A fault effect can only be resolved by resolving the ' \
8
+ 'fault which is its root cause.'
9
+ root '/resources/json/delphix/fault/effect'
10
+
11
+ get '/resources/json/delphix/fault/effect' do
12
+ description 'Returns the list of all the fault effects that match the ' \
13
+ 'given criteria.'
14
+ returns Array
15
+ name :list
16
+ end
17
+
18
+ get '/resources/json/delphix/fault/effect/{ref}' do
19
+ description 'Retrieve the specified FaultEffect object.'
20
+ returns Array
21
+ name :read
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,37 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :group do
6
+ description 'Database group.'
7
+ root '/resources/json/delphix/group'
8
+
9
+ get '/resources/json/delphix/group' do
10
+ description 'List Group objects on the system.'
11
+ returns Array
12
+ name :list
13
+ end
14
+
15
+ get '/resources/json/delphix/group/{ref}' do
16
+ description 'Retrieve the specified Group object.'
17
+ returns Array
18
+ name :read
19
+ end
20
+
21
+ post '/resources/json/delphix/group' do
22
+ description 'Create a new Group object.'
23
+ name :create
24
+ end
25
+
26
+ post '/resources/json/delphix/group/{ref}' do
27
+ description 'Update the specified Group object.'
28
+ name :update
29
+ end
30
+
31
+ delete '/resources/json/delphix/group/{ref}' do
32
+ description 'Deletes the specified group. Any databases within the group '\
33
+ 'must be deleted first, otherwise this will fail.'
34
+ name :delete
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,26 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :host do
6
+ description 'The representation of a host object.'
7
+ root '/resources/json/delphix/host'
8
+
9
+ get '/resources/json/delphix/host' do
10
+ description 'Returns the list of all hosts in the system.'
11
+ returns Array
12
+ name :list
13
+ end
14
+
15
+ get '/resources/json/delphix/host/{ref}' do
16
+ description 'Retrieve the specified Host object.'
17
+ returns Array
18
+ name :read
19
+ end
20
+
21
+ post '/resources/json/delphix/host/{ref}' do
22
+ description 'Update the specified Host object.'
23
+ name :update
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :job do
6
+ description 'Represents a job object.'
7
+ root '/resources/json/delphix/job'
8
+
9
+ get '/resources/json/delphix/job' do
10
+ description 'Returns a list of jobs in the system. Jobs are listed in ' \
11
+ 'start time order.'
12
+ returns Array
13
+ name :list
14
+ end
15
+
16
+ get '/resources/json/delphix/job/{ref}' do
17
+ description 'Retrieve the specified Job object.'
18
+ returns Array
19
+ name :read
20
+ end
21
+
22
+ post '/resources/json/delphix/job/{ref}' do
23
+ description 'Update the specified Job object.'
24
+ name :update
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,39 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :namespace do
6
+ description 'Objects within namespaces are always read-only. Attempts to ' \
7
+ 'modify those objects, or perform read-write operations using '\
8
+ 'them, will fail. When a namespace is failed over '\
9
+ '(activated), all objects become read-write (assuming there ' \
10
+ 'are no conflicts in terms of names or shared resources) and ' \
11
+ 'it is no longer possible to receive subsequent replication ' \
12
+ 'updates.'
13
+ root '/resources/json/delphix/namespace'
14
+
15
+ get '/resources/json/delphix/namespace' do
16
+ description 'List Namespace objects on the system.'
17
+ returns Array
18
+ name :list
19
+ end
20
+
21
+ get '/resources/json/delphix/namespace/{ref}' do
22
+ description 'Retrieve the specified Namespace object.'
23
+ returns Array
24
+ name :read
25
+ end
26
+
27
+ post '/resources/json/delphix/namespace/{ref}' do
28
+ description 'Update the specified Namespace object.'
29
+ name :update
30
+ end
31
+
32
+ delete '/resources/json/delphix/namespace/{ref}' do
33
+ description 'Deletes a namespace and all of the objects contained within '\
34
+ 'it. This will cause all of the objects in the namespace to ' \
35
+ 'be permanently removed.'
36
+ name :delete
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+
2
+ # Delphix Source API template
3
+
4
+ Croesus::DSL.evaluate do
5
+ resource :policy do
6
+ description 'The base policy type.'
7
+ root '/resources/json/delphix/policy'
8
+
9
+
10
+ get '/resources/json/delphix/policy' do
11
+ description 'Returns a list of policies in the domain.'
12
+ returns Array
13
+ name :list
14
+ end
15
+
16
+ get '/resources/json/delphix/policy/{ref}' do
17
+ description 'Retrieve the specified Policy object.'
18
+ returns Array
19
+ name :read
20
+ end
21
+
22
+ post '/resources/json/delphix/policy' do
23
+ description 'Creates a new policy, subject to restrictions (see docs).'
24
+ name :create
25
+ end
26
+
27
+ post '/resources/json/delphix/policy/{ref}' do
28
+ description 'Update the specified Policy object.'
29
+ name :update
30
+ end
31
+
32
+ delete '/resources/json/delphix/policy/{ref}' do
33
+ description 'Deletes the specified policy, subject to restrictions '\
34
+ '(see docs).'
35
+ name :delete
36
+ end
37
+ end
38
+ end