Class: Docker::Remote::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Client.



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

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.



11
12
13
# File 'lib/docker/remote/client.rb', line 11

def password
  @password
end

#registry_urlObject (readonly)

Returns the value of attribute registry_url.



11
12
13
# File 'lib/docker/remote/client.rb', line 11

def registry_url
  @registry_url
end

#repoObject (readonly)

Returns the value of attribute repo.



11
12
13
# File 'lib/docker/remote/client.rb', line 11

def repo
  @repo
end

#usernameObject (readonly)

Returns the value of attribute username.



11
12
13
# File 'lib/docker/remote/client.rb', line 11

def username
  @username
end

Instance Method Details

#catalogObject



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

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

#manifest_for(reference) ⇒ Object



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

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

#tagsObject



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

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