Class: Docker::Remote::Client

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/docker/remote/client.rb

Constant Summary collapse

PORTMAP =
{ 'ghcr.io' => 443 }.freeze
DEFAULT_PORT =
443
STANDARD_PORTS =
[DEFAULT_PORT, 80].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#potentially_raise_error!

Constructor Details

#initialize(registry_url, repo, username = nil, password = nil) ⇒ Client

Returns a new instance of Client.



20
21
22
23
24
25
# File 'lib/docker/remote/client.rb', line 20

def initialize(registry_url, repo, username = nil, password = nil)
  @registry_url = registry_url
  @repo = repo
  @username = username
  @password = password
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



14
15
16
# File 'lib/docker/remote/client.rb', line 14

def password
  @password
end

#registry_urlObject (readonly)

Returns the value of attribute registry_url.



14
15
16
# File 'lib/docker/remote/client.rb', line 14

def registry_url
  @registry_url
end

#repoObject (readonly)

Returns the value of attribute repo.



14
15
16
# File 'lib/docker/remote/client.rb', line 14

def repo
  @repo
end

#usernameObject (readonly)

Returns the value of attribute username.



14
15
16
# File 'lib/docker/remote/client.rb', line 14

def username
  @username
end

Instance Method Details

#catalogObject



39
40
41
42
43
# File 'lib/docker/remote/client.rb', line 39

def catalog
  response = get("/v2/_catalog")
  potentially_raise_error!(response)
  JSON.parse(response.body)
end

#manifest_for(reference) ⇒ Object



33
34
35
36
37
# File 'lib/docker/remote/client.rb', line 33

def manifest_for(reference)
  response = get("/v2/#{repo}/manifests/#{reference}")
  potentially_raise_error!(response)
  JSON.parse(response.body)
end

#tagsObject



27
28
29
30
31
# File 'lib/docker/remote/client.rb', line 27

def tags
  response = get("/v2/#{repo}/tags/list")
  potentially_raise_error!(response)
  JSON.parse(response.body)['tags']
end