Skip to content

Commit

Permalink
Use new compute API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
angristan committed Oct 11, 2020
1 parent abf7711 commit dc7b651
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Put your credentials to the fog configuration file:
default:
scaleway_organization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # Your organization ID
scaleway_token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # Your token
scaleway_region: par1 # par1 or ams1
scaleway_region: fr-par-1 # availability zone
```
Create a connection to the service:
Expand Down
14 changes: 11 additions & 3 deletions lib/fog/scaleway/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Real
def initialize(options)
@token = options[:scaleway_token]
@organization = options[:scaleway_organization]
@region = options[:scaleway_region] || 'par1'
@region = options[:scaleway_region] || 'fr-par-1'
@connection_options = options[:connection_options] || {}
end

Expand All @@ -146,11 +146,19 @@ def request(params)
private

def client
@client ||= Fog::Scaleway::Client.new(endpoint, @token, @connection_options)
@client ||= Fog::Scaleway::Client.new(endpoint, @token, connection_options)
end

def endpoint
"https://cp-#{@region}.scaleway.com"
'https://api.scaleway.com'
end

def connection_options
@connection_options.merge(path_prefix: path_prefix)
end

def path_prefix
"/instance/v1/zones/#{@region}"
end

def camelize(str)
Expand Down

0 comments on commit dc7b651

Please sign in to comment.