croesus 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +121 -0
- data/.ruby-version +1 -0
- data/API_operation.txt +197 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +0 -0
- data/README.md +146 -0
- data/Rakefile +26 -0
- data/bin/console_cmd.rb +133 -0
- data/croesus.gemspec +39 -0
- data/lib/croesus/associations.rb +46 -0
- data/lib/croesus/attribute.rb +41 -0
- data/lib/croesus/attributes.rb +93 -0
- data/lib/croesus/coerce.rb +110 -0
- data/lib/croesus/coercions/boolean_definitions.rb +32 -0
- data/lib/croesus/coercions/date_definitions.rb +30 -0
- data/lib/croesus/coercions/date_time_definitions.rb +30 -0
- data/lib/croesus/coercions/fixnum_definitions.rb +32 -0
- data/lib/croesus/coercions/float_definitions.rb +30 -0
- data/lib/croesus/coercions/hash_definitions.rb +27 -0
- data/lib/croesus/coercions/integer_definitions.rb +29 -0
- data/lib/croesus/coercions/string_definitions.rb +43 -0
- data/lib/croesus/coercions/time_definitions.rb +30 -0
- data/lib/croesus/core_ext/blank.rb +123 -0
- data/lib/croesus/core_ext/hash.rb +185 -0
- data/lib/croesus/dsl/dsl.rb +35 -0
- data/lib/croesus/dsl/helpers.rb +43 -0
- data/lib/croesus/dsl/mod_factory.rb +191 -0
- data/lib/croesus/dsl/resource_dsl.rb +59 -0
- data/lib/croesus/dsl/route_dsl.rb +42 -0
- data/lib/croesus/identity_map.rb +98 -0
- data/lib/croesus/platform.rb +47 -0
- data/lib/croesus/querying.rb +63 -0
- data/lib/croesus/resources/about.rb +15 -0
- data/lib/croesus/resources/basic_methods.rb +36 -0
- data/lib/croesus/resources/connectivity.rb +42 -0
- data/lib/croesus/resources/container.rb +135 -0
- data/lib/croesus/resources/fault.rb +38 -0
- data/lib/croesus/resources/fault_effect.rb +24 -0
- data/lib/croesus/resources/group.rb +37 -0
- data/lib/croesus/resources/host.rb +26 -0
- data/lib/croesus/resources/job.rb +27 -0
- data/lib/croesus/resources/namespace.rb +39 -0
- data/lib/croesus/resources/policy.rb +38 -0
- data/lib/croesus/resources/source.rb +86 -0
- data/lib/croesus/resources/source_config.rb +54 -0
- data/lib/croesus/resources/source_environment.rb +58 -0
- data/lib/croesus/resources/source_repository.rb +14 -0
- data/lib/croesus/resources/system_info.rb +21 -0
- data/lib/croesus/resources/timeflow.rb +40 -0
- data/lib/croesus/resources/timeflow_snapshot.rb +38 -0
- data/lib/croesus/utils.rb +262 -0
- data/lib/croesus/validations/many.rb +27 -0
- data/lib/croesus/validations/optional.rb +27 -0
- data/lib/croesus/validations.rb +91 -0
- data/lib/croesus/validators/base.rb +47 -0
- data/lib/croesus/validators/boolean_validator.rb +32 -0
- data/lib/croesus/validators/email_validator.rb +36 -0
- data/lib/croesus/validators/enumerable_validator.rb +40 -0
- data/lib/croesus/validators/hash_validator.rb +50 -0
- data/lib/croesus/validators/lambda_validator.rb +54 -0
- data/lib/croesus/validators/many_validator.rb +57 -0
- data/lib/croesus/validators/optional_validator.rb +41 -0
- data/lib/croesus/validators/presence_validator.rb +36 -0
- data/lib/croesus/validators/simple_type_validators.rb +38 -0
- data/lib/croesus/validators/simple_validator.rb +40 -0
- data/lib/croesus/version.rb +43 -0
- data/lib/croesus/web_client/web_client.rb +153 -0
- data/lib/croesus/web_client/web_request.rb +77 -0
- data/lib/croesus/web_client/web_response.rb +70 -0
- data/lib/croesus.rb +250 -0
- metadata +325 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 22d33e6e4cdd37db74378da89f2bd2f175e1ae71
|
4
|
+
data.tar.gz: fa8287cacf9e7742238a1544184e4e5e96303bc7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c2c7847b85e88e2ead476f02f467a913b8d1fb9bfe0b06e958091490cc2b2817661c0f5c694d42ac6964792e656665c71d5cca757658ebce27ffbcfdbe22833c
|
7
|
+
data.tar.gz: 7c97d5ace4c3263da5c4bc834df5720d910a6f01547e03f1b2aa3483d8eaf67633220a023380f01c34339689feca1111142308801ab8a2c352600dc0a770aa02
|
data/.gitignore
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# Created by https://www.gitignore.io
|
2
|
+
|
3
|
+
### Ruby ###
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
## Specific to RubyMotion:
|
16
|
+
.dat*
|
17
|
+
.repl_history
|
18
|
+
build/
|
19
|
+
|
20
|
+
## Documentation cache and generated files:
|
21
|
+
/.yardoc/
|
22
|
+
/_yardoc/
|
23
|
+
/doc/
|
24
|
+
/rdoc/
|
25
|
+
|
26
|
+
## Environment normalisation:
|
27
|
+
/.bundle/
|
28
|
+
/lib/bundler/man/
|
29
|
+
|
30
|
+
# for a library or gem, you might want to ignore these files since the code is
|
31
|
+
# intended to run in multiple environments; otherwise, check them in:
|
32
|
+
# Gemfile.lock
|
33
|
+
# .ruby-version
|
34
|
+
# .ruby-gemset
|
35
|
+
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
+
.rvmrc
|
38
|
+
|
39
|
+
|
40
|
+
### TextMate ###
|
41
|
+
*.tmproj
|
42
|
+
*.tmproject
|
43
|
+
tmtags
|
44
|
+
|
45
|
+
|
46
|
+
### SublimeText ###
|
47
|
+
# cache files for sublime text
|
48
|
+
*.tmlanguage.cache
|
49
|
+
*.tmPreferences.cache
|
50
|
+
*.stTheme.cache
|
51
|
+
|
52
|
+
# workspace files are user-specific
|
53
|
+
*.sublime-workspace
|
54
|
+
|
55
|
+
# project files should be checked into the repository, unless a significant
|
56
|
+
# proportion of contributors will probably not be using SublimeText
|
57
|
+
# *.sublime-project
|
58
|
+
|
59
|
+
# sftp configuration file
|
60
|
+
sftp-config.json
|
61
|
+
|
62
|
+
|
63
|
+
### Tags ###
|
64
|
+
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
65
|
+
TAGS
|
66
|
+
!TAGS/
|
67
|
+
tags
|
68
|
+
!tags/
|
69
|
+
gtags.files
|
70
|
+
GTAGS
|
71
|
+
GRTAGS
|
72
|
+
GPATH
|
73
|
+
cscope.files
|
74
|
+
cscope.out
|
75
|
+
cscope.in.out
|
76
|
+
cscope.po.out
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
### vim ###
|
81
|
+
[._]*.s[a-w][a-z]
|
82
|
+
[._]s[a-w][a-z]
|
83
|
+
*.un~
|
84
|
+
Session.vim
|
85
|
+
.netrwhist
|
86
|
+
*~
|
87
|
+
|
88
|
+
|
89
|
+
### Emacs ###
|
90
|
+
# -*- mode: gitignore; -*-
|
91
|
+
*~
|
92
|
+
\#*\#
|
93
|
+
/.emacs.desktop
|
94
|
+
/.emacs.desktop.lock
|
95
|
+
*.elc
|
96
|
+
auto-save-list
|
97
|
+
tramp
|
98
|
+
.\#*
|
99
|
+
|
100
|
+
# Org-mode
|
101
|
+
.org-id-locations
|
102
|
+
*_archive
|
103
|
+
|
104
|
+
# flymake-mode
|
105
|
+
*_flymake.*
|
106
|
+
|
107
|
+
# eshell files
|
108
|
+
/eshell/history
|
109
|
+
/eshell/lastdir
|
110
|
+
|
111
|
+
# elpa packages
|
112
|
+
/elpa/
|
113
|
+
|
114
|
+
# reftex files
|
115
|
+
*.rel
|
116
|
+
|
117
|
+
# AUCTeX auto folder
|
118
|
+
/auto/
|
119
|
+
|
120
|
+
SCRATCH
|
121
|
+
Gemfile.lock
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.3
|
data/API_operation.txt
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
# Operation | Description
|
4
|
+
# ----------|----------------------------------------------------------------|
|
5
|
+
# create | Create a new instance of the object type from the root static |
|
6
|
+
# | context. Not all objects can be created in this simplified |
|
7
|
+
# | fashion. Databases, for example, are created through the link |
|
8
|
+
# | and provision commands. |
|
9
|
+
# ----------|----------------------------------------------------------------|
|
10
|
+
# delete | Deletes an object that has been selected. Not all objects can |
|
11
|
+
# | be deleted. |
|
12
|
+
# ----------|----------------------------------------------------------------|
|
13
|
+
# get | Display all or some of the properties of an object after |
|
14
|
+
# | selecting it. |
|
15
|
+
# ----------|----------------------------------------------------------------|
|
16
|
+
# list | For a given object type (represented by a static context such |
|
17
|
+
# | as database), list the objects on the system, optionally |
|
18
|
+
# | constrained by some set of attributes. Some objects are global |
|
19
|
+
# | to the system and do not support this operation. |
|
20
|
+
# ----------|----------------------------------------------------------------|
|
21
|
+
# select | Select a particular object by name to get properties or |
|
22
|
+
# | perform an operation on the object. See the “Delphix Objects” |
|
23
|
+
# | section for more information on object naming. |
|
24
|
+
# ----------|----------------------------------------------------------------|
|
25
|
+
# update | Enter a command context to change one or more properties of an |
|
26
|
+
# | object after selecting. Not all objects support this operation,|
|
27
|
+
# | and only properties that can be edited are shown when in the |
|
28
|
+
# | update command context. |
|
29
|
+
# ----------|----------------------------------------------------------------|
|
30
|
+
|
31
|
+
Environment Components
|
32
|
+
An environment is the root of the representation of external state that manages
|
33
|
+
database instances. An environment could be a single host (UnixHostEnvironment)
|
34
|
+
or an Oracle cluster (OracleClusterEnvironment). Environments exist to contain
|
35
|
+
repositories, and each environment may have any number of repositories
|
36
|
+
associated with it. A repository is the entity that contains database instances.
|
37
|
+
Repositories are typically installation directories (OracleInstall) within an
|
38
|
+
environment. Within each repository of any number of SourceConfig objects, which
|
39
|
+
represent known database instances. The source config exists independent of
|
40
|
+
Delphix, and could represent a possible dSource (in which case there is no
|
41
|
+
associated database object), or could be managed entirely by Delphix (for VDBs).
|
42
|
+
The source config contains intrinsic properties of the database instance, while
|
43
|
+
the source (described below) contains information specific to Delphix and only
|
44
|
+
exists when the source config is linked to a dSource or VDB.
|
45
|
+
|
46
|
+
Most environment objects are created through the act of discovery. By specifying
|
47
|
+
a host, Delphix will attempt to automatically discover all environments,
|
48
|
+
repositories, and source configs. These objects can also be added manually after
|
49
|
+
the fact in cases where discovery fails.
|
50
|
+
|
51
|
+
The environment hierarchy can be represented this way:
|
52
|
+
|
53
|
+
|-------------------------------|
|
54
|
+
| Environment |
|
55
|
+
|-------------------------------|
|
56
|
+
| UnixHostEnvironment |
|
57
|
+
|-------------------------------|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|-------------------------------|
|
61
|
+
| SourceRepository |
|
62
|
+
|-------------------------------|
|
63
|
+
| OracleInstall |
|
64
|
+
|-------------------------------|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|-------------------------------|
|
68
|
+
| SourceConfig |
|
69
|
+
|-------------------------------|
|
70
|
+
| OracleSIConfig |
|
71
|
+
|-------------------------------|
|
72
|
+
|
73
|
+
|
74
|
+
The generic type is listed in the top portion of each box, with an example of
|
75
|
+
the Oracle single instance objects in the lower portion of each box. Each of
|
76
|
+
these objects can contain multiple child objects with it.
|
77
|
+
|
78
|
+
Database Components
|
79
|
+
The core of all databases within Delphix is the Container that contains all the
|
80
|
+
physical data associated with the database, whether it is a dSource or VDB.
|
81
|
+
Within each container is a Timeflow, which represents a single timeline of
|
82
|
+
change within the database history. Currently, a container can only have one
|
83
|
+
timeflow, though this limitation may be relaxed in a future release. Within a
|
84
|
+
timeflow are two important object: TimeflowSnapshot objects and TimeflowRange
|
85
|
+
objects. Timeflow ranges represent the provisionable ranges within the history
|
86
|
+
of the timeflow, while timeflow snapshot represent a point at which at snapshot
|
87
|
+
was taken and therefore more likely to provision in a short amount of time. The
|
88
|
+
resulting data hierarchy can be represented this way:
|
89
|
+
|
90
|
+
|-------------------------------|
|
91
|
+
| Container |
|
92
|
+
|-------------------------------|
|
93
|
+
| OracleDatabaseContainer |
|
94
|
+
|-------------------------------|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|-------------------------------|
|
98
|
+
| Timeflow |
|
99
|
+
|-------------------------------|
|
100
|
+
| OracleTimeflow |
|
101
|
+
|-------------------------------|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|-------------------------------|
|
105
|
+
| TimeflowSnapshot |
|
106
|
+
|-------------------------------|
|
107
|
+
| OracleSnapshot |
|
108
|
+
|-------------------------------|
|
109
|
+
|
110
|
+
|
111
|
+
Each container may be associated with a Source. A source is the Delphix
|
112
|
+
representation of an external database when it is associated with a container,
|
113
|
+
and contains information specific to managing that source. Not all source
|
114
|
+
configs within an environment have a source associated with them (as is the case
|
115
|
+
with linkable databases), but all sources must have a source config. Containers
|
116
|
+
may have no sources associated with them if they are unlined; sources can be
|
117
|
+
manually attached at a later point. Currently, each container can have at most
|
118
|
+
once source associated with it, though this may change in a future release.
|
119
|
+
|
120
|
+
|
121
|
+
Properties
|
122
|
+
|
|
123
|
+
currentTimeflow | A reference to the currently active timeflow for this
|
124
|
+
| container.
|
125
|
+
| Type: REFERENCE TO "Timeflow"
|
126
|
+
-------------------|------------------------------------------------------------
|
127
|
+
description | Optional user-provided description for the container.
|
128
|
+
| Type: STRING
|
129
|
+
| Constraints:
|
130
|
+
| Max Length: 1024
|
131
|
+
| Create: optional
|
132
|
+
| Update: optional
|
133
|
+
-------------------|------------------------------------------------------------
|
134
|
+
group | A reference to the group containing this container.
|
135
|
+
| Type: REFERENCE TO "Group"
|
136
|
+
| Constraints:
|
137
|
+
| Create: required
|
138
|
+
-------------------|------------------------------------------------------------
|
139
|
+
masked | Whether this container has the masked bit set.
|
140
|
+
| Type: boolean
|
141
|
+
| Constraints:
|
142
|
+
| Create: optional
|
143
|
+
| Update: optional
|
144
|
+
-------------------|------------------------------------------------------------
|
145
|
+
performanceMode | Users can enable Performance Mode to improve performance of
|
146
|
+
| write operations to their databases. If Performance Mode is
|
147
|
+
| enabled, data consistency is guaranteed, but there might
|
148
|
+
| be small amount of data loss in the case of Delphix Engine
|
149
|
+
| failure.
|
150
|
+
|
|
151
|
+
| Each time a Delphix Engine is restarted (whether caused by
|
152
|
+
| a failure or not), all virtual databases with Performance
|
153
|
+
| Mode enabled will be shutdown and restarted automatically.
|
154
|
+
| Type: boolean
|
155
|
+
| Constraints:
|
156
|
+
| Create: optional
|
157
|
+
| Update: optional
|
158
|
+
-------------------|------------------------------------------------------------
|
159
|
+
provisionContainer | A reference to the container this container was provisioned
|
160
|
+
| from.
|
161
|
+
| Type: REFERENCE TO "Container"
|
162
|
+
-------------------|------------------------------------------------------------
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
performanceMode
|
168
|
+
Users can enable Performance Mode to improve performance of write operations to their databases. If Performance Mode is enabled, data consistency is guaranteed, but there might be a small amount of data loss in the case of Delphix Engine failure.
|
169
|
+
|
170
|
+
Each time a Delphix Engine is restarted (whether caused by a failure or not), all virtual databases with Performance Mode enabled will be shutdown and restarted automatically.
|
171
|
+
|
172
|
+
Type: boolean
|
173
|
+
Constraints:
|
174
|
+
Create: optional
|
175
|
+
Update: optional
|
176
|
+
provisionContainer
|
177
|
+
A reference to the container this container was provisioned from.
|
178
|
+
|
179
|
+
Type: Reference to Container
|
180
|
+
runtime
|
181
|
+
Runtime properties of this container.
|
182
|
+
|
183
|
+
Type: DBContainerRuntime
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
File without changes
|
data/README.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
SOURCE
|
2
|
+
# ==============================================================================
|
3
|
+
#
|
4
|
+
# Sources represent external database instances outside the Delphix system.
|
5
|
+
# These can be linked sources (which pull data into Delphix from pre-existing
|
6
|
+
# databases) or virtual sources, which export data from Delphix to arbitrary
|
7
|
+
# targets.
|
8
|
+
#
|
9
|
+
# Sources are attached to Container (database) objects, which hold the actual
|
10
|
+
# data for the source. Every source has a SourceConfig object associated with
|
11
|
+
# it, though not all source configs have associated sources. The source config
|
12
|
+
# tracks information that is intrinsic to the external database, independent of
|
13
|
+
# whether it is incorporated into the Delphix system is any way. Both linked
|
14
|
+
# and virtual sources share the same config for a particular database type
|
15
|
+
# (though it may differ, for example, between Oracle single instance and RAC).
|
16
|
+
# Source configs without a source exist for externally-controlled
|
17
|
+
# (link-capable) databases, while source configs for virtual sources are
|
18
|
+
# created as needed and managed by Delphix. The hierarchy of objects is:
|
19
|
+
#
|
20
|
+
# * Source
|
21
|
+
# * SourceConfig
|
22
|
+
# * SourceRepository
|
23
|
+
# * SourceEnvironment
|
24
|
+
#
|
25
|
+
# Sources can have SourceRuntime properties that are not stored with the
|
26
|
+
# persistent representation of the object, but pulled on demand from the
|
27
|
+
# running database instance. These runtime properties therefore may not always
|
28
|
+
# be available, and cannot be manipulated via Delphix.
|
29
|
+
#
|
30
|
+
# TypedObject
|
31
|
+
# |__PersistentObject
|
32
|
+
# |__UserObject
|
33
|
+
# |__Source
|
34
|
+
# | -----\
|
35
|
+
# |__PgSQLSource \
|
36
|
+
# |__OracleSource \ ______ [ Known Subclasses ]
|
37
|
+
# |__MSSqlSource /
|
38
|
+
# |__AppDataSource /
|
39
|
+
# -----/
|
40
|
+
#
|
41
|
+
#
|
42
|
+
module Croesus::API
|
43
|
+
# P R O P E R T I E S
|
44
|
+
#
|
45
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
46
|
+
# config | Reference to the configuration for the source.
|
47
|
+
# | Type: Reference to SourceConfig.
|
48
|
+
# | Constraints:
|
49
|
+
# | Create: optional
|
50
|
+
#
|
51
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
52
|
+
# container | Reference to the container being fed by this source,
|
53
|
+
# | if any.
|
54
|
+
# | Type: Reference to Container
|
55
|
+
#
|
56
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
57
|
+
# description | A user-provided description of the source.
|
58
|
+
# | Type: string
|
59
|
+
#
|
60
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
61
|
+
# enabled | Flag indicating whether the source is enabled.
|
62
|
+
# | Type: boolean
|
63
|
+
#
|
64
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
65
|
+
# runtime | Runtime properties of this source.
|
66
|
+
# | Type: SourceRuntime
|
67
|
+
#
|
68
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
69
|
+
# staging | Flag indicating whether the source is used as a staging
|
70
|
+
# | source for pre-provisioning. Staging sources are
|
71
|
+
# | managed by the Delphix system.
|
72
|
+
# | Type: boolean
|
73
|
+
#
|
74
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
75
|
+
# status | Status of this source.
|
76
|
+
# | Type: boolean
|
77
|
+
# | Constraints:
|
78
|
+
# | Acceptable values: DEFAULT, PENDING_UPGRADE
|
79
|
+
#
|
80
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
81
|
+
# virtual | Flag indicating whether the source is managed by the
|
82
|
+
# | Delphix system.
|
83
|
+
# | Type: boolean
|
84
|
+
#
|
85
|
+
#
|
86
|
+
# I N H E R I T E D P R O P E R T I E S
|
87
|
+
#
|
88
|
+
# Object Type: UserObject
|
89
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
90
|
+
# name | Object name
|
91
|
+
# | Type: objectName
|
92
|
+
# | Constraints:
|
93
|
+
# | Max Length: 256
|
94
|
+
# | Create: optional
|
95
|
+
# | Update: optional
|
96
|
+
#
|
97
|
+
# Object Type: PersistentObject
|
98
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
99
|
+
# namespace | Alternate namespace for this object, for replicated and
|
100
|
+
# | restored objects.
|
101
|
+
# | Type: Reference to Namespace
|
102
|
+
#
|
103
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
104
|
+
# reference | Object reference.
|
105
|
+
# | Type: Reference to PersistentObject
|
106
|
+
#
|
107
|
+
# Object Type: TypedObject
|
108
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
109
|
+
# type | Object type.
|
110
|
+
# | Type: type
|
111
|
+
# | Constraints:
|
112
|
+
# | Required: true
|
113
|
+
#
|
114
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
115
|
+
#
|
116
|
+
class Source
|
117
|
+
# S T A N D A R D O P E R A T I O N S
|
118
|
+
#
|
119
|
+
# List
|
120
|
+
# @note GET /resources/json/delphix/source
|
121
|
+
# Lists sources on the system, optionally list only.
|
122
|
+
#
|
123
|
+
# @param [String] source
|
124
|
+
# @option source database List sources associated with the given
|
125
|
+
# container reference.
|
126
|
+
# Type: Reference to Container.
|
127
|
+
# @option source environment List sources associated with the given source
|
128
|
+
# environment reference.
|
129
|
+
# Type: Reference to SourceEnvironment.
|
130
|
+
# @option source repository List sources associated with the given source
|
131
|
+
# repository reference.
|
132
|
+
# Type: Reference to SourceEnvironment
|
133
|
+
#
|
134
|
+
# @return [Array(Source)] Array of Type: Source
|
135
|
+
#
|
136
|
+
# @api public
|
137
|
+
def self.list(source = nil)
|
138
|
+
Croesus.get(filter_url(source))
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
require 'rubocop/rake_task'
|
5
|
+
require 'yard'
|
6
|
+
|
7
|
+
desc 'Run tests'
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
|
10
|
+
desc 'Run Rubocop on the gem'
|
11
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
12
|
+
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
13
|
+
task.fail_on_error = true
|
14
|
+
end
|
15
|
+
|
16
|
+
YARD::Config.load_plugin 'redcarpet-ext'
|
17
|
+
YARD::Rake::YardocTask.new do |t|
|
18
|
+
t.files = ['**/*.rb', '-', 'README.md', 'CHANGELOG.md', 'LICENSE.txt']
|
19
|
+
t.options = ['--markup-provider=redcarpet', '--markup=markdown']
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Build documentation'
|
23
|
+
task doc: [:yard]
|
24
|
+
|
25
|
+
task default: [:spec, :rubocop, :build, :install]
|
26
|
+
|
data/bin/console_cmd.rb
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# encoding: UTF-8
|
4
|
+
#
|
5
|
+
# Author: Stefano Harding <riddopic@gmail.com>
|
6
|
+
#
|
7
|
+
# Copyright (C) 2014 Stefano Harding
|
8
|
+
#
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
# you may not use this file except in compliance with the License.
|
11
|
+
# You may obtain a copy of the License at
|
12
|
+
#
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
#
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
18
|
+
# implied. See the License for the specific language governing
|
19
|
+
# permissions and limitations under the License.
|
20
|
+
#
|
21
|
+
$: << File.dirname(__FILE__) + '/../lib'
|
22
|
+
|
23
|
+
require 'pry'
|
24
|
+
require 'croesus'
|
25
|
+
require 'command_line_reporter'
|
26
|
+
|
27
|
+
include CommandLineReporter
|
28
|
+
include Croesus::Utils
|
29
|
+
|
30
|
+
# add ability to reload console
|
31
|
+
def reload
|
32
|
+
reload_msg = '# Reloading the console...'
|
33
|
+
files = $LOADED_FEATURES.select { |feat| feat =~ /\/croesus\// }
|
34
|
+
files.each { |file| load file }
|
35
|
+
puts CodeRay.scan(reload_msg, :ruby).term
|
36
|
+
exec($0)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Construct a custom Pry prompt proc.
|
40
|
+
#
|
41
|
+
# @param char [String] prompt character
|
42
|
+
# @return [proc] a prompt proc
|
43
|
+
# @api private
|
44
|
+
def prompt(char)
|
45
|
+
proc { |target_self, nest_level, pry|
|
46
|
+
[
|
47
|
+
"[#{pry.input_array.size}] ",
|
48
|
+
"Cc^(#{Pry.view_clip(target_self.class)})",
|
49
|
+
"#{":#{nest_level}" unless nest_level.zero?}#{char} "
|
50
|
+
].join
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def menu
|
55
|
+
resources ||= []
|
56
|
+
Croesus::AnonoMod.registry.each do |key, value|
|
57
|
+
resources << key
|
58
|
+
end
|
59
|
+
puts
|
60
|
+
dyno_width = terminal_dimensions[0] - 32
|
61
|
+
header title: 'Welcome to the Delphix Engine Ruby Rumble in the Jungle!',
|
62
|
+
align: 'center', width: terminal_dimensions[0]
|
63
|
+
table border: true do
|
64
|
+
row header: true, color: 'red' do
|
65
|
+
column 'Num', width: 3, align: 'right', color: 'blue', padding: 0
|
66
|
+
column 'Resource Name', width: 18, align: 'left', padding: 0
|
67
|
+
column "Description (http://#{Croesus.server}/api/json/delphix.json)",
|
68
|
+
width: dyno_width, align: 'left', padding: 0
|
69
|
+
end
|
70
|
+
resources.sort.each.with_index(1) do |resource, i|
|
71
|
+
row do
|
72
|
+
column '%02d' % i
|
73
|
+
column classify(resource)
|
74
|
+
column Croesus::AnonoMod.registry[resource].description
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
footer title: 'For help on a resource try help resource name'
|
79
|
+
end
|
80
|
+
|
81
|
+
def define_resource_methods
|
82
|
+
Croesus::AnonoMod.registry.each do |key, value|
|
83
|
+
# define_method(key) { Croesus::AnonoMod.registry[key.to_sym] }
|
84
|
+
define_method(key) do |*args|
|
85
|
+
Croesus::AnonoMod.registry[key.to_sym].send :"#{args}"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def define_resource_methods
|
91
|
+
Croesus::AnonoMod.registry.each do |key, value|
|
92
|
+
# define_method(key) { Croesus::AnonoMod.registry[key.to_sym] }
|
93
|
+
define_method(key) do |*args|
|
94
|
+
puts "Croesus::AnonoMod.registry[#{key.to_sym}] send #{args}"
|
95
|
+
# Croesus::AnonoMod.registry[key.to_sym].send :"#{args}"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def delphix_json_api
|
101
|
+
Croesus.get "http://#{Croesus.server}/api/json/delphix.json"
|
102
|
+
end
|
103
|
+
|
104
|
+
# Setup and connect
|
105
|
+
# Croesus.server = ''
|
106
|
+
# Croesus.api_user = ''
|
107
|
+
# Croesus.api_passwd = ''
|
108
|
+
# Croesus.verbose = true
|
109
|
+
# Croesus.session.body
|
110
|
+
|
111
|
+
welcome = <<eos
|
112
|
+
______ ______ ____
|
113
|
+
.~ ~. |`````````, .~ ~. | ..'''' | | ..''''
|
114
|
+
| |'''|''''' | | |______ .'' | | .''
|
115
|
+
| | `. | | | ..' | | ..'
|
116
|
+
`.______.' | `. `.______.' |___________ ....'' `._______.' ....''
|
117
|
+
|
118
|
+
|
119
|
+
eos
|
120
|
+
puts CodeRay.scan(welcome, :ruby).term
|
121
|
+
define_resource_methods
|
122
|
+
menu
|
123
|
+
puts
|
124
|
+
puts 'Use `exit` to quit the live session.'
|
125
|
+
puts 'Use `q` to jump out of displaying a large output.'
|
126
|
+
puts 'Use `reload` to reload a session.'
|
127
|
+
puts
|
128
|
+
puts 'Type menu at anytime to see the menu.'
|
129
|
+
puts
|
130
|
+
Pry.start(@config, :prompt => [prompt(' >> '), prompt("*")])
|
131
|
+
Pry.start
|
132
|
+
|
133
|
+
|
data/croesus.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib/', __FILE__)
|
4
|
+
$:.unshift lib unless $:.include?(lib)
|
5
|
+
|
6
|
+
require 'croesus/version'
|
7
|
+
|
8
|
+
Gem::Specification.new do |s|
|
9
|
+
s.name = 'croesus'
|
10
|
+
s.version = Croesus::VERSION
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.date = Time.now.strftime("%Y-%m-%d")
|
13
|
+
s.summary = 'Council with the Delphic oracle, King of Lydia'
|
14
|
+
s.description = 'Ruby REST client for Delphix virtual database appliance'
|
15
|
+
s.authors = ['Stefano Harding']
|
16
|
+
s.email = 'riddopic@gmail.com'
|
17
|
+
s.homepage = 'https://github.com/riddopic/croesus'
|
18
|
+
s.license = 'Apache 2.0'
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split
|
21
|
+
s.test_files = `git ls-files spec/*`.split
|
22
|
+
|
23
|
+
s.add_dependency 'awesome_print'
|
24
|
+
s.add_dependency 'command_line_reporter'
|
25
|
+
s.add_dependency 'addressable', '>= 2.3.6'
|
26
|
+
s.add_dependency 'rest-client', '>= 1.6.7'
|
27
|
+
s.add_dependency 'json', '>= 1.8.1'
|
28
|
+
|
29
|
+
s.add_development_dependency 'yard', '>= 0.8.6'
|
30
|
+
s.add_development_dependency 'github-markup', '>= 1.3.0'
|
31
|
+
s.add_development_dependency 'redcarpet', '>= 3.2.0'
|
32
|
+
s.add_development_dependency 'yard-redcarpet-ext', '>= 0.0.3'
|
33
|
+
s.add_development_dependency 'rubocop', '>= 0.26.0'
|
34
|
+
s.add_development_dependency 'rake', '>= 10.3.2'
|
35
|
+
s.add_development_dependency 'coveralls', '>= 0.7.1'
|
36
|
+
s.add_development_dependency 'rspec', '>= 3.1.0'
|
37
|
+
s.add_development_dependency 'fuubar', '>= 2.0.0'
|
38
|
+
s.add_development_dependency 'timecop', '>= 0.7.1'
|
39
|
+
end
|