provider/dyn.go
func (d *dynProviderState) login() (*dynect.Client, error) {
	if d.LastLoginErrorTime != 0 {
		secondsSinceLastError := unixNow() - d.LastLoginErrorTime
		if secondsSinceLastError < badLoginMinIntervalSeconds {
			return nil, fmt.Errorf("will not attempt an API call as the last login failure occurred just %ds ago", secondsSinceLastError)
		}
	}
	client := dynect.NewClient(d.CustomerName)

	var req = dynect.LoginBlock{
		Username:     d.Username,
		Password:     d.Password,
		CustomerName: d.CustomerName}

	var resp dynect.LoginResponse

	err := client.Do("POST", "Session", req, &resp)
	if err != nil {
		d.LastLoginErrorTime = unixNow()
		return nil, err
	}

	d.LastLoginErrorTime = 0
	client.Token = resp.Data.Token

	// this is the only change from the original
	d.DynVersion = resp.Data.Version
	return client, nil
}
func (d *dynProviderState) login() (*dynect.Client, error) {
	if d.LastLoginErrorTime != 0 {
		secondsSinceLastError := unixNow() - d.LastLoginErrorTime
		if secondsSinceLastError < badLoginMinIntervalSeconds {
			return nil, fmt.Errorf("will not attempt an API call as the last login failure occurred just %ds ago", secondsSinceLastError)
		}
	}
	client := dynect.NewClient(d.CustomerName)

	var req = dynect.LoginBlock{
		Username:     d.Username,
		Password:     d.Password,
		CustomerName: d.CustomerName}

	var resp dynect.LoginResponse

	err := client.Do("POST", "Session", req, &resp)
	if err != nil {
		d.LastLoginErrorTime = unixNow()
		return nil, err
	}

	d.LastLoginErrorTime = 0
	client.Token = resp.Data.Token

	// this is the only change from the original
	d.DynVersion = resp.Data.Version
	return client, nil
}
func ( d * dynProviderState ) login ( ) ( * dynect . Client , error ) { if d . LastLoginErrorTime != 0 { secondsSinceLastError := unixNow ( ) - d . LastLoginErrorTime if secondsSinceLastError < badLoginMinIntervalSeconds { return nil , fmt . Errorf ( " " , secondsSinceLastError ) } } client := dynect . NewClient ( d . CustomerName ) var req = dynect . LoginBlock { Username : d . Username , Password : d . Password , CustomerName : d . CustomerName } var resp dynect . LoginResponse err := client . Do ( " " , " " , req , & resp ) if err != nil { d . LastLoginErrorTime = unixNow ( ) return nil , err } d . LastLoginErrorTime = 0 client . Token = resp . Data . Token // this is the only change from the original d . DynVersion = resp . Data . Version return client , nil }
// create a dynect client and performs login. You need to clean it up.
// This method also stores the DynAPI version.
// Don't user the dynect.Client.Login()
create a dynect client and performs login . You need to clean it up . This method also stores the DynAPI version . Don t user the dynect . Client . Login ()