doctl 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +32 -0
- data/Gemfile.lock +240 -0
- data/bin/doctl +39 -0
- data/doctl.gemspec +34 -0
- data/lib/dldinternet/doctl/account/command.rb +39 -0
- data/lib/dldinternet/doctl/account/mixins/no_commands.rb +12 -0
- data/lib/dldinternet/doctl/api/account.rb +2 -0
- data/lib/dldinternet/doctl/api/account/get.rb +18 -0
- data/lib/dldinternet/doctl/api/account/ratelimit.rb +22 -0
- data/lib/dldinternet/doctl/api/auth.rb +1 -0
- data/lib/dldinternet/doctl/api/auth/get.rb +16 -0
- data/lib/dldinternet/doctl/api/auth/mixins/get/getnameservers.rb +17 -0
- data/lib/dldinternet/doctl/api/base.rb +120 -0
- data/lib/dldinternet/doctl/api/compute.rb +1 -0
- data/lib/dldinternet/doctl/api/compute/domain.rb +6 -0
- data/lib/dldinternet/doctl/api/compute/domain/create.rb +29 -0
- data/lib/dldinternet/doctl/api/compute/domain/delete.rb +28 -0
- data/lib/dldinternet/doctl/api/compute/domain/get.rb +20 -0
- data/lib/dldinternet/doctl/api/compute/domain/list.rb +24 -0
- data/lib/dldinternet/doctl/api/compute/domain/records.rb +4 -0
- data/lib/dldinternet/doctl/api/compute/domain/records/create.rb +30 -0
- data/lib/dldinternet/doctl/api/compute/domain/records/delete.rb +30 -0
- data/lib/dldinternet/doctl/api/compute/domain/records/list.rb +33 -0
- data/lib/dldinternet/doctl/api/compute/domain/records/update.rb +30 -0
- data/lib/dldinternet/doctl/auth/command.rb +19 -0
- data/lib/dldinternet/doctl/auth/init/command.rb +18 -0
- data/lib/dldinternet/doctl/auth/init/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/auth/mixins/no_commands.rb +12 -0
- data/lib/dldinternet/doctl/compute/action/command.rb +30 -0
- data/lib/dldinternet/doctl/compute/action/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/action/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/action/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/action/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/action/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/action/wait/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/action/wait/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/command.rb +81 -0
- data/lib/dldinternet/doctl/compute/domain/command.rb +105 -0
- data/lib/dldinternet/doctl/compute/domain/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/domain/records/command.rb +89 -0
- data/lib/dldinternet/doctl/compute/domain/records/mixins/no_commands.rb +62 -0
- data/lib/dldinternet/doctl/compute/droplet-action/change-kernel/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/change-kernel/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/command.rb +86 -0
- data/lib/dldinternet/doctl/compute/droplet-action/disable-backups/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/disable-backups/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/enable-ipv6/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/enable-ipv6/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/enable-private-networking/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/enable-private-networking/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/droplet-action/password-reset/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/password-reset/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/power-cycle/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/power-cycle/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/power-off/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/power-off/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/power-on/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/power-on/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/reboot/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/reboot/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/rebuild/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/rebuild/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/rename/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/rename/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/resize/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/resize/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/restore/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/restore/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/shutdown/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/shutdown/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/snapshot/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/snapshot/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet-action/upgrade/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet-action/upgrade/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/actions/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/actions/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/backups/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/backups/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/command.rb +62 -0
- data/lib/dldinternet/doctl/compute/droplet/create/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/create/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/delete/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/delete/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/kernels/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/kernels/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/droplet/neighbors/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/neighbors/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/snapshots/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/snapshots/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/tag/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/tag/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/droplet/untag/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/droplet/untag/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/assign/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/assign/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/command.rb +30 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/unassign/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/floating-ip-action/unassign/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip/command.rb +34 -0
- data/lib/dldinternet/doctl/compute/floating-ip/create/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/floating-ip/create/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip/delete/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/floating-ip/delete/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/floating-ip/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/floating-ip/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/floating-ip/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/image-action/command.rb +26 -0
- data/lib/dldinternet/doctl/compute/image-action/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image-action/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image-action/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/image-action/transfer/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image-action/transfer/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image/command.rb +46 -0
- data/lib/dldinternet/doctl/compute/image/delete/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image/delete/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image/list-application/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image/list-application/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image/list-distribution/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image/list-distribution/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image/list-user/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image/list-user/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/image/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/image/update/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/image/update/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/mixins/no_commands.rb +12 -0
- data/lib/dldinternet/doctl/compute/plugin/command.rb +26 -0
- data/lib/dldinternet/doctl/compute/plugin/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/plugin/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/plugin/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/plugin/run/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/plugin/run/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/region/command.rb +22 -0
- data/lib/dldinternet/doctl/compute/region/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/region/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/region/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/size/command.rb +22 -0
- data/lib/dldinternet/doctl/compute/size/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/size/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/size/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/ssh-key/command.rb +42 -0
- data/lib/dldinternet/doctl/compute/ssh-key/create/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/ssh-key/create/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/ssh-key/delete/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/ssh-key/delete/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/ssh-key/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/ssh-key/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/ssh-key/import/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/ssh-key/import/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/ssh-key/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/ssh-key/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/ssh-key/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/ssh-key/update/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/ssh-key/update/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/ssh/command.rb +18 -0
- data/lib/dldinternet/doctl/compute/ssh/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/tag/command.rb +38 -0
- data/lib/dldinternet/doctl/compute/tag/create/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/tag/create/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/tag/delete/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/tag/delete/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/tag/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/tag/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/tag/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/tag/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/tag/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/tag/update/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/tag/update/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/volume-action/attach/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/volume-action/attach/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/volume-action/command.rb +26 -0
- data/lib/dldinternet/doctl/compute/volume-action/detach/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/volume-action/detach/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/volume-action/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/compute/volume/command.rb +34 -0
- data/lib/dldinternet/doctl/compute/volume/create/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/volume/create/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/volume/delete/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/volume/delete/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/volume/get/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/volume/get/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/volume/list/command.rb +20 -0
- data/lib/dldinternet/doctl/compute/volume/list/mixins/no_commands.rb +18 -0
- data/lib/dldinternet/doctl/compute/volume/mixins/no_commands.rb +16 -0
- data/lib/dldinternet/doctl/main.rb +35 -0
- data/lib/dldinternet/doctl/mixins/no_commands.rb +8 -0
- data/lib/dldinternet/doctl/version.rb +5 -0
- metadata +421 -0
@@ -0,0 +1 @@
|
|
1
|
+
require 'dldinternet/doctl/api/auth/get'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'dldinternet/doctl/api/base'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module NameServers
|
7
|
+
class Get < DLDInternet::DOctl::API::Base
|
8
|
+
|
9
|
+
require 'dldinternet/doctl/api/auth/mixins/get/getnameservers'
|
10
|
+
include DLDInternet::DOctl::API::Auth::MixIns::Get::GetNameServers
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'droplet_kit'
|
2
|
+
require 'droplet_kit/client.rb'
|
3
|
+
require 'droplet_kit/mappings/account_mapping.rb'
|
4
|
+
require 'droplet_kit/models/account.rb'
|
5
|
+
|
6
|
+
module DropletKit
|
7
|
+
class Account < BaseModel
|
8
|
+
attribute :droplet_limit
|
9
|
+
attribute :floating_ip_limit
|
10
|
+
attribute :email
|
11
|
+
attribute :uuid
|
12
|
+
attribute :email_verified
|
13
|
+
attribute :status
|
14
|
+
attribute :status_message
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module DropletKit
|
19
|
+
class AccountMapping
|
20
|
+
include Kartograph::DSL
|
21
|
+
|
22
|
+
kartograph do
|
23
|
+
root_key singular: 'account', scopes: [:read]
|
24
|
+
mapping Account
|
25
|
+
|
26
|
+
scoped :read do
|
27
|
+
property :droplet_limit
|
28
|
+
property :floating_ip_limit
|
29
|
+
property :email
|
30
|
+
property :uuid
|
31
|
+
property :email_verified
|
32
|
+
property :status
|
33
|
+
property :status_message
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# module DropletKit
|
40
|
+
# class RatelimitMapping
|
41
|
+
# include Kartograph::DSL
|
42
|
+
#
|
43
|
+
# kartograph do
|
44
|
+
# root_key singular: 'account', scopes: [:read]
|
45
|
+
# mapping Account
|
46
|
+
#
|
47
|
+
# scoped :read do
|
48
|
+
# property :droplet_limit
|
49
|
+
# property :floating_ip_limit
|
50
|
+
# property :email
|
51
|
+
# property :uuid
|
52
|
+
# property :email_verified
|
53
|
+
# property :status
|
54
|
+
# property :status_message
|
55
|
+
# end
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
|
60
|
+
module DropletKit
|
61
|
+
class RatelimitResource < ResourceKit::Resource
|
62
|
+
|
63
|
+
attr :response
|
64
|
+
|
65
|
+
include ErrorHandlingResourcable
|
66
|
+
|
67
|
+
resources do
|
68
|
+
default_handler(:ok) {|r|
|
69
|
+
#AccountMapping.extract_single(r.body, :read)
|
70
|
+
@response = r
|
71
|
+
}
|
72
|
+
get '/v2/account' => :info
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
module DLDInternet
|
78
|
+
module DOctl
|
79
|
+
module API
|
80
|
+
class Client < ::DropletKit::Client
|
81
|
+
def self.resources
|
82
|
+
{
|
83
|
+
actions: ::DropletKit::ActionResource,
|
84
|
+
droplets: ::DropletKit::DropletResource,
|
85
|
+
domains: ::DropletKit::DomainResource,
|
86
|
+
domain_records: ::DropletKit::DomainRecordResource,
|
87
|
+
droplet_actions: ::DropletKit::DropletActionResource,
|
88
|
+
images: ::DropletKit::ImageResource,
|
89
|
+
image_actions: ::DropletKit::ImageActionResource,
|
90
|
+
regions: ::DropletKit::RegionResource,
|
91
|
+
sizes: ::DropletKit::SizeResource,
|
92
|
+
ssh_keys: ::DropletKit::SSHKeyResource,
|
93
|
+
snapshots: ::DropletKit::SnapshotResource,
|
94
|
+
account: ::DropletKit::AccountResource,
|
95
|
+
ratelimit: ::DropletKit::RatelimitResource,
|
96
|
+
floating_ips: ::DropletKit::FloatingIpResource,
|
97
|
+
floating_ip_actions: ::DropletKit::FloatingIpActionResource,
|
98
|
+
tags: ::DropletKit::TagResource,
|
99
|
+
volumes: ::DropletKit::VolumeResource,
|
100
|
+
volume_actions: ::DropletKit::VolumeActionResource
|
101
|
+
}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class Base
|
106
|
+
attr_reader :options, :logger, :client
|
107
|
+
|
108
|
+
def client
|
109
|
+
@client ||= DLDInternet::DOctl::API::Client.new(access_token: options[:access_token])
|
110
|
+
end
|
111
|
+
|
112
|
+
def initialize(options, logger=nil)
|
113
|
+
@options = options
|
114
|
+
@logger = logger
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'dldinternet/doctl/api/compute/domain'
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require 'dldinternet/doctl/api/base'
|
2
|
+
require 'dldinternet/doctl/api/compute/domain/list'
|
3
|
+
require 'dldinternet/doctl/api/compute/domain/get'
|
4
|
+
require 'dldinternet/doctl/api/compute/domain/create'
|
5
|
+
require 'dldinternet/doctl/api/compute/domain/delete'
|
6
|
+
require 'dldinternet/doctl/api/compute/domain/records'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module DLDInternet
|
5
|
+
module DOctl
|
6
|
+
module API
|
7
|
+
module Compute
|
8
|
+
module Domain
|
9
|
+
class Create < DLDInternet::DOctl::API::Base
|
10
|
+
|
11
|
+
# noinspection RubyUnnecessaryReturnValue
|
12
|
+
def CreateDomain(domain, ip_address)
|
13
|
+
client.domains.create(Hashie::Mash.new({name: domain, ip_address: ip_address}))
|
14
|
+
rescue ::DropletKit::Error => e
|
15
|
+
if matches = e.message.match(%r{^([0-9]{3}):\s+(\{.*\})\s*$})
|
16
|
+
json = JSON.parse(matches[2])
|
17
|
+
@logger.fatal json['message']
|
18
|
+
else
|
19
|
+
@logger.fatal e.message
|
20
|
+
end
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module Compute
|
7
|
+
module Domain
|
8
|
+
class Delete < DLDInternet::DOctl::API::Base
|
9
|
+
|
10
|
+
# noinspection RubyUnnecessaryReturnValue
|
11
|
+
def DeleteDomain(domain)
|
12
|
+
client.domains.delete(name: domain)
|
13
|
+
rescue ::DropletKit::Error => e
|
14
|
+
if matches = e.message.match(%r{^([0-9]{3}):\s+(\{.*\})\s*$})
|
15
|
+
json = JSON.parse(matches[2])
|
16
|
+
@logger.fatal json['message']
|
17
|
+
else
|
18
|
+
@logger.fatal e.message
|
19
|
+
end
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module Compute
|
7
|
+
module Domain
|
8
|
+
class Get < DLDInternet::DOctl::API::Base
|
9
|
+
|
10
|
+
# noinspection RubyUnnecessaryReturnValue
|
11
|
+
def GetDomain(domain)
|
12
|
+
client.domains.find(name: domain)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module Compute
|
7
|
+
module Domain
|
8
|
+
class List < DLDInternet::DOctl::API::Base
|
9
|
+
|
10
|
+
# noinspection RubyUnnecessaryReturnValue
|
11
|
+
def GetDomainList()
|
12
|
+
list = []
|
13
|
+
client.domains.all().each do |page|
|
14
|
+
list << page
|
15
|
+
end
|
16
|
+
list
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module Compute
|
7
|
+
module Domain
|
8
|
+
module Records
|
9
|
+
class Create < DLDInternet::DOctl::API::Base
|
10
|
+
|
11
|
+
# noinspection RubyUnnecessaryReturnValue
|
12
|
+
def CreateDomainRecord(domain, record)
|
13
|
+
client.domain_records.create(record, for_domain: domain)
|
14
|
+
rescue ::DropletKit::Error => e
|
15
|
+
if matches = e.message.match(%r{^([0-9]{3}):\s+(\{.*\})\s*$})
|
16
|
+
json = JSON.parse(matches[2])
|
17
|
+
@logger.fatal json['message']
|
18
|
+
else
|
19
|
+
@logger.fatal e.message
|
20
|
+
end
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module Compute
|
7
|
+
module Domain
|
8
|
+
module Records
|
9
|
+
class Delete < DLDInternet::DOctl::API::Base
|
10
|
+
|
11
|
+
# noinspection RubyUnnecessaryReturnValue
|
12
|
+
def DeleteDomainRecord(domain, id)
|
13
|
+
client.domain_records.delete(id: id, for_domain: domain)
|
14
|
+
rescue ::DropletKit::Error => e
|
15
|
+
if matches = e.message.match(%r{^([0-9]{3}):\s+(\{.*\})\s*$})
|
16
|
+
json = JSON.parse(matches[2])
|
17
|
+
@logger.fatal json['message']
|
18
|
+
else
|
19
|
+
@logger.fatal e.message
|
20
|
+
end
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module Compute
|
7
|
+
module Domain
|
8
|
+
module Records
|
9
|
+
class List < DLDInternet::DOctl::API::Base
|
10
|
+
|
11
|
+
# noinspection RubyUnnecessaryReturnValue
|
12
|
+
def GetDomainRecordsList(domain)
|
13
|
+
list = []
|
14
|
+
client.domain_records.all(for_domain: domain).each do |page|
|
15
|
+
list << page
|
16
|
+
end
|
17
|
+
list
|
18
|
+
rescue ::DropletKit::Error => e
|
19
|
+
if matches = e.message.match(%r{^([0-9]{3}):\s+(\{.*\})\s*$})
|
20
|
+
json = JSON.parse(matches[2])
|
21
|
+
@logger.fatal json['message']
|
22
|
+
else
|
23
|
+
@logger.fatal e.message
|
24
|
+
end
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'hashie/mash'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module API
|
6
|
+
module Compute
|
7
|
+
module Domain
|
8
|
+
module Records
|
9
|
+
class Update < DLDInternet::DOctl::API::Base
|
10
|
+
|
11
|
+
# noinspection RubyUnnecessaryReturnValue
|
12
|
+
def UpdateDomainRecord(domain, record, id)
|
13
|
+
client.domain_records.create(record, for_domain: domain, id: id)
|
14
|
+
rescue ::DropletKit::Error => e
|
15
|
+
if matches = e.message.match(%r{^([0-9]{3}):\s+(\{.*\})\s*$})
|
16
|
+
json = JSON.parse(matches[2])
|
17
|
+
@logger.fatal json['message']
|
18
|
+
else
|
19
|
+
@logger.fatal e.message
|
20
|
+
end
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'dldinternet/doctl/auth/init/command'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module Auth
|
6
|
+
class Command < DLDInternet::Thor::Command
|
7
|
+
no_commands do
|
8
|
+
|
9
|
+
require 'dldinternet/doctl/auth/mixins/no_commands'
|
10
|
+
include DLDInternet::DOctl::Auth::MixIns::NoCommands
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'init SUBCOMMAND ... ARGS', 'initialize configuration'
|
15
|
+
subcommand 'init', ::DLDInternet::DOctl::Auth::Init::Command
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'dldinternet/doctl/api/auth'
|
2
|
+
|
3
|
+
module DLDInternet
|
4
|
+
module DOctl
|
5
|
+
module Auth
|
6
|
+
module Init
|
7
|
+
class Command < DLDInternet::Thor::Command
|
8
|
+
no_commands do
|
9
|
+
|
10
|
+
require 'dldinternet/doctl/auth/init/mixins/no_commands'
|
11
|
+
include DLDInternet::DOctl::Auth::Init::MixIns::NoCommands
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|