dnsmadeeasy 0.3.2 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +174 -0
- data/.travis.yml +8 -4
- data/Gemfile +2 -0
- data/README.md +133 -31
- data/Rakefile +8 -7
- data/bin/console +1 -0
- data/dnsmadeeasy.gemspec +42 -28
- data/exe/dme +1 -3
- data/lib/dme.rb +9 -5
- data/lib/dnsmadeeasy.rb +18 -8
- data/lib/dnsmadeeasy/api/client.rb +86 -49
- data/lib/dnsmadeeasy/credentials.rb +4 -4
- data/lib/dnsmadeeasy/credentials/api_keys.rb +7 -5
- data/lib/dnsmadeeasy/credentials/yaml_file.rb +16 -9
- data/lib/dnsmadeeasy/dme.rb +2 -4
- data/lib/dnsmadeeasy/runner.rb +119 -104
- data/lib/dnsmadeeasy/version.rb +3 -1
- metadata +74 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071e02ddbb88d13234c3a135672e186062472b44f6a0b3227fd4f9b5c5097205
|
4
|
+
data.tar.gz: '04249c110d948a410e2235716b2e05c70fa76667a7dd338d409883f8f03dfa6d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df525957ac6b092b428fbd236e85b19ea0d5fda02b7c3a91d813e06ac22376ff7c94e5434fb4b39aa90969c03f926c73efb73b9704686f44c7b84ca10121a8e5
|
7
|
+
data.tar.gz: 356ea81dffbf405a73ffce3e0c8278e6b329746769c983b9397793c50773ec3ec853b430f6f31781f5e9f3a1ca424e3a173a7c54d5727ac79a9be94a081de7ea
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-12-03 14:53:41 -0800 using RuboCop version 0.77.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 3
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: EnforcedStyle.
|
12
|
+
# SupportedStyles: space, no_space
|
13
|
+
Layout/HeredocIndentation:
|
14
|
+
Exclude:
|
15
|
+
- dnsmadeeasy.gemspec
|
16
|
+
|
17
|
+
Layout/SpaceInsideParens:
|
18
|
+
Exclude:
|
19
|
+
- 'Rakefile'
|
20
|
+
- 'spec/lib/dnsmadeeasy/api/client_spec.rb'
|
21
|
+
|
22
|
+
# Offense count: 3
|
23
|
+
Lint/AmbiguousRegexpLiteral:
|
24
|
+
Exclude:
|
25
|
+
- 'spec/lib/dnsmadeeasy/credentials/api_keys_spec.rb'
|
26
|
+
- 'spec/lib/dnsmadeeasy/runner_spec.rb'
|
27
|
+
|
28
|
+
# Offense count: 3
|
29
|
+
# Configuration parameters: MaximumRangeSize.
|
30
|
+
Lint/MissingCopEnableDirective:
|
31
|
+
Exclude:
|
32
|
+
- 'dnsmadeeasy.gemspec'
|
33
|
+
- 'lib/dnsmadeeasy/runner.rb'
|
34
|
+
|
35
|
+
# Offense count: 5
|
36
|
+
# Cop supports --auto-correct.
|
37
|
+
Lint/RedundantCopDisableDirective:
|
38
|
+
Exclude:
|
39
|
+
- 'lib/dnsmadeeasy/runner.rb'
|
40
|
+
|
41
|
+
# Offense count: 1
|
42
|
+
Lint/UselessAssignment:
|
43
|
+
Exclude:
|
44
|
+
- 'lib/dnsmadeeasy/runner.rb'
|
45
|
+
|
46
|
+
# Offense count: 7
|
47
|
+
Metrics/AbcSize:
|
48
|
+
Max: 37
|
49
|
+
|
50
|
+
# Offense count: 2
|
51
|
+
# Configuration parameters: CountComments.
|
52
|
+
Metrics/ClassLength:
|
53
|
+
Max: 250
|
54
|
+
|
55
|
+
# Offense count: 2
|
56
|
+
Metrics/CyclomaticComplexity:
|
57
|
+
Max: 12
|
58
|
+
|
59
|
+
# Offense count: 11
|
60
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
61
|
+
Metrics/MethodLength:
|
62
|
+
Max: 29
|
63
|
+
|
64
|
+
# Offense count: 3
|
65
|
+
# Configuration parameters: CountKeywordArgs.
|
66
|
+
Metrics/ParameterLists:
|
67
|
+
Max: 8
|
68
|
+
|
69
|
+
# Offense count: 2
|
70
|
+
Metrics/PerceivedComplexity:
|
71
|
+
Max: 14
|
72
|
+
|
73
|
+
# Offense count: 1
|
74
|
+
# Configuration parameters: AllowedChars.
|
75
|
+
Style/AsciiComments:
|
76
|
+
Exclude:
|
77
|
+
- 'lib/dnsmadeeasy/credentials.rb'
|
78
|
+
|
79
|
+
# Offense count: 4
|
80
|
+
# Cop supports --auto-correct.
|
81
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.
|
82
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
83
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
84
|
+
# FunctionalMethods: let, let!, subject, watch
|
85
|
+
# IgnoredMethods: lambda, proc, it
|
86
|
+
Style/BlockDelimiters:
|
87
|
+
Exclude:
|
88
|
+
- 'spec/lib/dnsmadeeasy/api/client_spec.rb'
|
89
|
+
- 'spec/lib/dnsmadeeasy/credentials/yaml_file_spec.rb'
|
90
|
+
|
91
|
+
# Offense count: 6
|
92
|
+
Style/Documentation:
|
93
|
+
Exclude:
|
94
|
+
- 'spec/**/*'
|
95
|
+
- 'test/**/*'
|
96
|
+
- 'lib/dme.rb'
|
97
|
+
- 'lib/dnsmadeeasy.rb'
|
98
|
+
- 'lib/dnsmadeeasy/api/client.rb'
|
99
|
+
- 'lib/dnsmadeeasy/credentials.rb'
|
100
|
+
- 'lib/dnsmadeeasy/credentials/yaml_file.rb'
|
101
|
+
- 'lib/dnsmadeeasy/runner.rb'
|
102
|
+
|
103
|
+
# Offense count: 5
|
104
|
+
# Configuration parameters: MinBodyLength.
|
105
|
+
Style/GuardClause:
|
106
|
+
Exclude:
|
107
|
+
- 'lib/dnsmadeeasy.rb'
|
108
|
+
- 'lib/dnsmadeeasy/api/client.rb'
|
109
|
+
- 'lib/dnsmadeeasy/credentials/api_keys.rb'
|
110
|
+
- 'lib/dnsmadeeasy/runner.rb'
|
111
|
+
|
112
|
+
# Offense count: 1
|
113
|
+
# Cop supports --auto-correct.
|
114
|
+
Style/IfUnlessModifier:
|
115
|
+
Exclude:
|
116
|
+
- 'lib/dnsmadeeasy/runner.rb'
|
117
|
+
|
118
|
+
# Offense count: 3
|
119
|
+
# Cop supports --auto-correct.
|
120
|
+
# Configuration parameters: PreferredDelimiters.
|
121
|
+
Style/PercentLiteralDelimiters:
|
122
|
+
Exclude:
|
123
|
+
- 'Rakefile'
|
124
|
+
- 'dnsmadeeasy.gemspec'
|
125
|
+
- 'lib/dnsmadeeasy/runner.rb'
|
126
|
+
|
127
|
+
# Offense count: 8
|
128
|
+
# Cop supports --auto-correct.
|
129
|
+
# Configuration parameters: AllowAsExpressionSeparator.
|
130
|
+
Style/Semicolon:
|
131
|
+
Exclude:
|
132
|
+
- 'lib/dnsmadeeasy.rb'
|
133
|
+
|
134
|
+
# Offense count: 2
|
135
|
+
# Cop supports --auto-correct.
|
136
|
+
# Configuration parameters: EnforcedStyle.
|
137
|
+
# SupportedStyles: only_raise, only_fail, semantic
|
138
|
+
Style/SignalException:
|
139
|
+
Exclude:
|
140
|
+
- 'lib/dnsmadeeasy/api/client.rb'
|
141
|
+
|
142
|
+
# Offense count: 5
|
143
|
+
# Cop supports --auto-correct.
|
144
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
145
|
+
# SupportedStyles: single_quotes, double_quotes
|
146
|
+
Style/StringLiterals:
|
147
|
+
Exclude:
|
148
|
+
- 'Gemfile'
|
149
|
+
- 'Rakefile'
|
150
|
+
- 'lib/dnsmadeeasy/credentials/api_keys.rb'
|
151
|
+
- 'spec/lib/dnsmadeeasy/api/client_spec.rb'
|
152
|
+
|
153
|
+
# Offense count: 1
|
154
|
+
# Cop supports --auto-correct.
|
155
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
156
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
157
|
+
Style/TrailingCommaInArrayLiteral:
|
158
|
+
Exclude:
|
159
|
+
- 'spec/lib/dnsmadeeasy/api/client_spec.rb'
|
160
|
+
|
161
|
+
# Offense count: 1
|
162
|
+
# Cop supports --auto-correct.
|
163
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
164
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
165
|
+
Style/TrailingCommaInHashLiteral:
|
166
|
+
Exclude:
|
167
|
+
- 'spec/lib/dnsmadeeasy/api/client_spec.rb'
|
168
|
+
|
169
|
+
# Offense count: 97
|
170
|
+
# Cop supports --auto-correct.
|
171
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
172
|
+
# URISchemes: http, https
|
173
|
+
Metrics/LineLength:
|
174
|
+
Max: 305
|
data/.travis.yml
CHANGED
@@ -5,16 +5,20 @@ sudo: false
|
|
5
5
|
language: ruby
|
6
6
|
cache: bundler
|
7
7
|
rvm:
|
8
|
-
- 2.
|
9
|
-
- 2.3
|
10
|
-
|
8
|
+
- 2.3.6
|
9
|
+
- 2.4.3
|
10
|
+
- 2.5.0
|
11
|
+
- 2.6.5
|
12
|
+
- jruby-9.1.15.0
|
13
|
+
before_install: gem install bundler -v 2.0.2
|
11
14
|
before_script:
|
15
|
+
- gem update --system
|
12
16
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
|
13
17
|
> ./cc-test-reporter
|
14
18
|
- chmod +x ./cc-test-reporter
|
15
19
|
- "./cc-test-reporter before-build"
|
16
20
|
script:
|
17
21
|
- bundle exec rspec
|
22
|
+
- bundle exec rubocop
|
18
23
|
after_script:
|
19
24
|
- "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
|
20
|
-
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -39,40 +39,40 @@ Once you have the key and the secret, you have several choices:
|
|
39
39
|
```
|
40
40
|
|
41
41
|
3. Configuring API keys as above is easy, and can be done using environment variables. Alternatively, it may be convenient to store credentials in a YAML file.
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
|
43
|
+
* If filename is not specified, there is default location where this file is searched, which is `~/.dnsmadeeasy/credentials.yml`.
|
44
|
+
* If filename is provided, it will be read, and must conform to the following format:
|
45
45
|
|
46
|
-
|
46
|
+
**Simple Credentials Format**
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
```yaml
|
49
|
+
# file: ~/.dnsmadeeasy/credentials.yml
|
50
|
+
credentials:
|
51
|
+
api_key: 2062259f-f666b17-b1fa3b48-042ad4030
|
52
|
+
api_secret: 2265bc3-e31ead-95b286312e-c215b6a0
|
53
|
+
```
|
54
54
|
|
55
|
-
|
55
|
+
**Multi-Account Credentials Format**
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
```yaml
|
60
|
-
accounts:
|
61
|
-
- name: development
|
62
|
-
default_account: true
|
63
|
-
credentials:
|
64
|
-
api_key: 12345678-a8f8-4466-ffff-2324aaaa9098
|
65
|
-
api_secret: 43009899-abcc-ffcc-eeee-09f809808098
|
66
|
-
- name: production
|
67
|
-
credentials:
|
68
|
-
api_key: "BAhTOh1TeW06OkRhdGE6OldyYXBwZXJT............"
|
69
|
-
api_secret: "BAhTOh1TeW06OkRhdGE6OldyYXBwZ............"
|
70
|
-
encryption_key: spec/fixtures/sym.key
|
71
|
-
```
|
57
|
+
Below you see two accounts, with production key and secret being encrypted. See [further below](#encryption) about encrypting your key and secrets.
|
72
58
|
|
73
|
-
|
59
|
+
```yaml
|
60
|
+
accounts:
|
61
|
+
- name: development
|
62
|
+
default_account: true
|
63
|
+
credentials:
|
64
|
+
api_key: 12345678-a8f8-4466-ffff-2324aaaa9098
|
65
|
+
api_secret: 43009899-abcc-ffcc-eeee-09f809808098
|
66
|
+
- name: production
|
67
|
+
credentials:
|
68
|
+
api_key: "BAhTOh1TeW06OkRhdGE6OldyYXBwZXJT............"
|
69
|
+
api_secret: "BAhTOh1TeW06OkRhdGE6OldyYXBwZ............"
|
70
|
+
encryption_key: spec/fixtures/sym.key
|
71
|
+
```
|
72
|
+
|
73
|
+
You can use the following method to access both simple and multi-account YAML configurations:
|
74
74
|
|
75
|
-
|
75
|
+
```ruby
|
76
76
|
require 'dnsmadeeasy'
|
77
77
|
DnsMadeEasy.configure_from_file(file, account = nil, encryption_key = nil)
|
78
78
|
|
@@ -85,17 +85,17 @@ Once you have the key and the secret, you have several choices:
|
|
85
85
|
'config/dme.yaml',
|
86
86
|
'production',
|
87
87
|
ENV['PRODUCTION_KEY'])
|
88
|
-
|
88
|
+
```
|
89
89
|
|
90
90
|
3. Finally, you can use `DME.credentials_from_file` method that, unlike the method above, uses hash arguments:
|
91
91
|
|
92
|
-
|
92
|
+
```ruby
|
93
93
|
@creds = DnsMadeEasy.credentials_from_file(file: 'my-creds.yml',
|
94
94
|
account: 'production',
|
95
95
|
encryption_key: 'MY_KEY')
|
96
96
|
@creds.api_key # => ...
|
97
97
|
@creds.api_secret # => ...
|
98
|
-
|
98
|
+
```
|
99
99
|
|
100
100
|
Method above simply returns the credentials instance, but does not "save" it as the default credentials like `configure_from_file`. Therefore, if you need to access multiple accounts at the same time, this method will help you maintain multiple credentials at the same time.
|
101
101
|
|
@@ -250,6 +250,21 @@ Here is the complete of all methods supported by the `DnsMadeEasy::Api::Client`:
|
|
250
250
|
* `find_first`
|
251
251
|
* `find_record_ids`
|
252
252
|
|
253
|
+
#### Secondary Domains
|
254
|
+
* `secondary_domain`
|
255
|
+
* `secondary_domains`
|
256
|
+
* `get_id_by_secondary_domain`
|
257
|
+
* `create_secondary_domain`
|
258
|
+
* `create_secondary_domains`
|
259
|
+
* `update_secondary_domains`
|
260
|
+
* `delete_secondary_domain`
|
261
|
+
|
262
|
+
#### Secondary IpSets
|
263
|
+
* `secondary_ip_set`
|
264
|
+
* `secondary_ip_sets`
|
265
|
+
* `create_secondary_ip_set`
|
266
|
+
* `update_secondary_ip_set`
|
267
|
+
* `delete_secondary_ip_set`
|
253
268
|
|
254
269
|
<a name="encryption"></a>
|
255
270
|
|
@@ -337,6 +352,9 @@ Valid Operations Are:
|
|
337
352
|
create_ns_record
|
338
353
|
create_ptr_record
|
339
354
|
create_record
|
355
|
+
create_secondary_domain
|
356
|
+
create_secondary_domains
|
357
|
+
create_secondary_ip_set
|
340
358
|
create_spf_record
|
341
359
|
create_srv_record
|
342
360
|
create_txt_record
|
@@ -344,15 +362,24 @@ Valid Operations Are:
|
|
344
362
|
delete_domain
|
345
363
|
delete_record
|
346
364
|
delete_records
|
365
|
+
delete_secondary_domain
|
366
|
+
delete_secondary_ip_set
|
347
367
|
domain
|
348
368
|
domains
|
349
369
|
find_all
|
350
370
|
find_first
|
351
371
|
find_record_ids
|
352
372
|
get_id_by_domain
|
373
|
+
get_id_by_secondary_domain
|
353
374
|
records_for
|
375
|
+
secondary_domain
|
376
|
+
secondary_domains
|
377
|
+
secondary_ip_set
|
378
|
+
secondary_ip_sets
|
354
379
|
update_record
|
355
380
|
update_records
|
381
|
+
update_secondary_domains
|
382
|
+
update_secondary_ip_set
|
356
383
|
```
|
357
384
|
|
358
385
|
For example:
|
@@ -419,6 +446,81 @@ To delete a domain:
|
|
419
446
|
DME.delete_domain ('test.io')
|
420
447
|
```
|
421
448
|
|
449
|
+
### Managing Secondary Domains
|
450
|
+
|
451
|
+
To retrieve all secondary domains:
|
452
|
+
```ruby
|
453
|
+
DME.secondary_domains
|
454
|
+
```
|
455
|
+
|
456
|
+
To retrieve secondary domain by id:
|
457
|
+
|
458
|
+
```ruby
|
459
|
+
DME.secondary_domain(domain_id)
|
460
|
+
```
|
461
|
+
|
462
|
+
To retrieve the id of a domain by the secondary domain name:
|
463
|
+
|
464
|
+
```ruby
|
465
|
+
DME.get_id_by_secondary_domain('test.io')
|
466
|
+
```
|
467
|
+
|
468
|
+
To create a secondary domain:
|
469
|
+
|
470
|
+
```ruby
|
471
|
+
# IP_SET_ID is id of ip_set you want to associate domain with
|
472
|
+
DME.create_secondary_domain('test.io', IP_SET_ID)
|
473
|
+
|
474
|
+
# Multiple domains can be created by:
|
475
|
+
DME.create_secondary_domains(%w[test.io moo.re], IP_SET_ID)
|
476
|
+
```
|
477
|
+
|
478
|
+
To update a secondary domain:
|
479
|
+
|
480
|
+
```ruby
|
481
|
+
# IP_SET_ID is id of ip_set you want to associate
|
482
|
+
# DOMAIN_ID is id of domain
|
483
|
+
DME.update_secondary_domains([DOMAIN_ID], IP_SET_ID)
|
484
|
+
```
|
485
|
+
|
486
|
+
To delete a secondary domain:
|
487
|
+
|
488
|
+
```ruby
|
489
|
+
DME.delete_secondary_domain('test.io')
|
490
|
+
```
|
491
|
+
|
492
|
+
### Managing Secondary IpSets
|
493
|
+
|
494
|
+
To retrieve all secondary IpSets:
|
495
|
+
```ruby
|
496
|
+
DME.secondary_ip_sets
|
497
|
+
```
|
498
|
+
|
499
|
+
To retrieve single ipSet:
|
500
|
+
|
501
|
+
```ruby
|
502
|
+
DME.secondary_ip_set(IP_SET_ID)
|
503
|
+
```
|
504
|
+
|
505
|
+
To create an ipSet:
|
506
|
+
|
507
|
+
```ruby
|
508
|
+
# IP_LIST is list of ips to be associated with this ip_set, like %w[8.8.8.8, 1.1.1.1]
|
509
|
+
DME.create_secondary_ip_set('ip-set-name', IP_LIST)
|
510
|
+
```
|
511
|
+
|
512
|
+
To update an ipSet:
|
513
|
+
|
514
|
+
```ruby
|
515
|
+
DME.update_secondary_ip_set(IP_SET_ID, 'ip-list-name', IP_LIST)
|
516
|
+
```
|
517
|
+
|
518
|
+
To delete an ipSet:
|
519
|
+
|
520
|
+
```ruby
|
521
|
+
DME.delete_secondary_ip_set(IP_SET_ID)
|
522
|
+
```
|
523
|
+
|
422
524
|
### Managing Records
|
423
525
|
|
424
526
|
To retrieve all records for a given domain name:
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
3
5
|
require 'yard'
|
@@ -13,22 +15,21 @@ task :permissions do
|
|
13
15
|
shell("find . -type d -exec chmod o+x,g+x {} \\;")
|
14
16
|
end
|
15
17
|
|
16
|
-
task :
|
18
|
+
task build: :permissions
|
17
19
|
|
18
20
|
YARD::Rake::YardocTask.new(:doc) do |t|
|
19
21
|
t.files = %w(lib/**/*.rb exe/*.rb - README.md LICENSE.txt)
|
20
|
-
t.options.unshift('--title','DNS Client for DnsMadeEasy')
|
21
|
-
t.after = ->
|
22
|
+
t.options.unshift('--title', 'DNS Client for DnsMadeEasy')
|
23
|
+
t.after = -> { exec('open doc/index.html') }
|
22
24
|
end
|
23
25
|
|
24
26
|
RSpec::Core::RakeTask.new(:spec)
|
25
27
|
|
26
|
-
task :
|
27
|
-
task :
|
28
|
+
task default: :spec
|
29
|
+
task gem: :install do
|
28
30
|
gem = `ls -1 *.gemspec | sed 's/\.gemspec//g'`.chomp
|
29
31
|
puts "gem is #{gem}"
|
30
32
|
puts `gem uninstall -ax #{gem}`.chomp
|
31
|
-
file
|
33
|
+
file = `ls -1 pkg`.chomp
|
32
34
|
puts `gem install pkg/#{file}`
|
33
35
|
end
|
34
|
-
|