mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[zerigo] change user to email and add credentials example
This commit is contained in:
parent
4d739e6054
commit
d7927812e6
3 changed files with 39 additions and 37 deletions
|
@ -5,7 +5,7 @@ require 'fog'
|
|||
|
||||
LINODE_API_KEY = '--put-your-key-here--'
|
||||
SLICEHOST_PASSWORD = '--put-your-key-here--'
|
||||
ZERIGO_USER = '--put-your-username-here--'
|
||||
ZERIGO_EMAIL = '--put-your-email-here--'
|
||||
ZERIGO_PASSWORD = '--put-your-password-here--'
|
||||
|
||||
|
||||
|
@ -158,21 +158,21 @@ def show_slicehost_dns_usage( password)
|
|||
end
|
||||
|
||||
# example of how to use Zerigo DNS calls
|
||||
def show_zerigo_dns_usage( username, password)
|
||||
def show_zerigo_dns_usage(email, password)
|
||||
|
||||
#check if we have a value api key for this cloud
|
||||
if username == '--put-your-username-here--'
|
||||
if email == '--put-your-email-here--'
|
||||
return false
|
||||
end
|
||||
|
||||
begin
|
||||
#connect to Zerigo
|
||||
options = { :zerigo_user => username, :zerigo_password => password }
|
||||
options = { :zerigo_email => email, :zerigo_password => password }
|
||||
cloud = Fog::Zerigo::Compute.new( options)
|
||||
|
||||
#create a domain
|
||||
options = { :nx_ttl => 1800 }
|
||||
response = cloud.create_zone( "sample-domain.com", 3600, 'pri_sec', options)
|
||||
response = cloud.create_zone( "sample-domain.com", 3600, 'pri_sec', options)
|
||||
if response.status == 201
|
||||
zone_id = response.body['id']
|
||||
end
|
||||
|
@ -267,6 +267,6 @@ end
|
|||
|
||||
# note, if you have not added your key for a given provider, the related function will do nothing
|
||||
|
||||
show_linode_dns_usage( LINODE_API_KEY)
|
||||
show_slicehost_dns_usage( SLICEHOST_PASSWORD)
|
||||
show_zerigo_dns_usage( ZERIGO_USER, ZERIGO_PASSWORD)
|
||||
show_linode_dns_usage(LINODE_API_KEY)
|
||||
show_slicehost_dns_usage(SLICEHOST_PASSWORD)
|
||||
show_zerigo_dns_usage(ZERIGO_EMAIL, ZERIGO_PASSWORD)
|
||||
|
|
|
@ -47,33 +47,35 @@ To run as '#{credential}', add the following to your resource config file: #{con
|
|||
An alternate file may be used by placing its path in the FOG_RC environment variable
|
||||
|
||||
#######################################################
|
||||
# Fog Resource Config File
|
||||
# Fog Credentials File
|
||||
#
|
||||
# Key-value pairs should look like:
|
||||
# :aws_access_key_id: 022QF06E7MXBSAMPLE
|
||||
# :aws_access_key_id: 022QF06E7MXBSAMPLE
|
||||
:#{credential}:
|
||||
:aws_access_key_id:
|
||||
:aws_secret_access_key:
|
||||
:bluebox_api_key:
|
||||
:bluebox_customer_id:
|
||||
:brightbox_client_id:
|
||||
:brightbox_secret:
|
||||
:go_grid_api_key:
|
||||
:go_grid_shared_secret:
|
||||
:google_storage_access_key_id:
|
||||
:google_storage_secret_access_key:
|
||||
:local_root:
|
||||
:new_servers_password:
|
||||
:new_servers_username:
|
||||
:public_key_path:
|
||||
:private_key_path:
|
||||
:rackspace_api_key:
|
||||
:rackspace_username:
|
||||
:slicehost_password:
|
||||
:terremark_username:
|
||||
:terremark_password:
|
||||
:aws_access_key_id:
|
||||
:aws_secret_access_key:
|
||||
:bluebox_api_key:
|
||||
:bluebox_customer_id:
|
||||
:brightbox_client_id:
|
||||
:brightbox_secret:
|
||||
:go_grid_api_key:
|
||||
:go_grid_shared_secret:
|
||||
:google_storage_access_key_id:
|
||||
:google_storage_secret_access_key:
|
||||
:local_root:
|
||||
:new_servers_password:
|
||||
:new_servers_username:
|
||||
:public_key_path:
|
||||
:private_key_path:
|
||||
:rackspace_api_key:
|
||||
:rackspace_username:
|
||||
:slicehost_password:
|
||||
:terremark_username:
|
||||
:terremark_password:
|
||||
:zerigo_email:
|
||||
:zerigo_password:
|
||||
#
|
||||
# End of Fog Resource Config File
|
||||
# End of Fog Credentials File
|
||||
#######################################################
|
||||
|
||||
YML
|
||||
|
|
|
@ -2,7 +2,7 @@ module Fog
|
|||
module Zerigo
|
||||
class Compute < Fog::Service
|
||||
|
||||
requires :zerigo_user, :zerigo_password, &inject_parameter_specs
|
||||
requires :zerigo_email, :zerigo_password, &inject_parameter_specs
|
||||
recognizes :timeout, :persistent, &inject_parameter_specs
|
||||
|
||||
# model_path 'fog/zerigo/models/compute'
|
||||
|
@ -40,9 +40,9 @@ module Fog
|
|||
end
|
||||
|
||||
def initialize(options={})
|
||||
@zerigo_user = options[:zerigo_user]
|
||||
@zerigo_email = options[:zerigo_email]
|
||||
@zerigo_password = options[:zerigo_password]
|
||||
@data = self.class.data[@zerigo_user]
|
||||
@data = self.class.data[@zerigo_email]
|
||||
@data = self.class.data[@zerigo_password]
|
||||
end
|
||||
|
||||
|
@ -51,8 +51,8 @@ module Fog
|
|||
class Real
|
||||
|
||||
def initialize(options={})
|
||||
@zerigo_user = options[:zerigo_user]
|
||||
@zerigo_password = options[:zerigo_password]
|
||||
@zerigo_email = options[:zerigo_email]
|
||||
@zerigo_password = options[:zerigo_password]
|
||||
@host = options[:host] || "ns.zerigo.com"
|
||||
@port = options[:port] || 80
|
||||
@scheme = options[:scheme] || 'http'
|
||||
|
@ -65,7 +65,7 @@ module Fog
|
|||
|
||||
def request(params)
|
||||
params[:headers] ||= {}
|
||||
key= "#{@zerigo_user}:#{@zerigo_password}"
|
||||
key= "#{@zerigo_email}:#{@zerigo_password}"
|
||||
params[:headers].merge!({
|
||||
'Authorization' => "Basic #{Base64.encode64(key).delete("\r\n")}"
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue