func (d *dynProviderState) fetchAllRecordsInZone(zone string) (*dynectsoap.GetAllRecordsResponseType, error) {
	var err error
	client := dynectsoap.NewClient("https://api2.dynect.net/SOAP/")
	service := dynectsoap.NewDynect(client)

	sessionRequest := dynectsoap.SessionLoginRequestType{
		Customer_name:  d.CustomerName,
		User_name:      d.Username,
		Password:       d.Password,
		Fault_incompat: 0,
	}
	resp := dynectsoap.SessionLoginResponseType{}
	err = apiRetryLoop(func() error {
		return service.Do(&sessionRequest, &resp)
	})

	if err != nil {
		return nil, err
	}

	token := resp.Data.Token

	logoutRequest := dynectsoap.SessionLogoutRequestType{
		Token:          token,
		Fault_incompat: 0,
	}
	logoutResponse := dynectsoap.SessionLogoutResponseType{}
	defer service.Do(&logoutRequest, &logoutResponse)

	req := dynectsoap.GetAllRecordsRequestType{
		Token:          token,
		Zone:           zone,
		Fault_incompat: 0,
	}
	records := dynectsoap.GetAllRecordsResponseType{}
	err = apiRetryLoop(func() error {
		return service.Do(&req, &records)
	})

	if err != nil {
		return nil, err
	}
	log.Debugf("Got all Records, status is %s", records.Status)

	if strings.ToLower(records.Status) == "incomplete" {
		jobRequest := dynectsoap.GetJobRequestType{
			Token:          token,
			Job_id:         records.Job_id,
			Fault_incompat: 0,
		}

		jobResults := dynectsoap.GetJobResponseType{}
		err = apiRetryLoop(func() error {
			return service.GetJobRetry(&jobRequest, &jobResults)
		})
		if err != nil {
			return nil, err
		}
		return jobResults.Data.(*dynectsoap.GetAllRecordsResponseType), nil
	}

	return &records, nil

}
func (d *dynProviderState) fetchAllRecordsInZone(zone string) (*dynectsoap.GetAllRecordsResponseType, error) {
	var err error
	client := dynectsoap.NewClient("https:
	service := dynectsoap.NewDynect(client)

	sessionRequest := dynectsoap.SessionLoginRequestType{
		Customer_name:  d.CustomerName,
		User_name:      d.Username,
		Password:       d.Password,
		Fault_incompat: 0,
	}
	resp := dynectsoap.SessionLoginResponseType{}
	err = apiRetryLoop(func() error {
		return service.Do(&sessionRequest, &resp)
	})

	if err != nil {
		return nil, err
	}

	token := resp.Data.Token

	logoutRequest := dynectsoap.SessionLogoutRequestType{
		Token:          token,
		Fault_incompat: 0,
	}
	logoutResponse := dynectsoap.SessionLogoutResponseType{}
	defer service.Do(&logoutRequest, &logoutResponse)

	req := dynectsoap.GetAllRecordsRequestType{
		Token:          token,
		Zone:           zone,
		Fault_incompat: 0,
	}
	records := dynectsoap.GetAllRecordsResponseType{}
	err = apiRetryLoop(func() error {
		return service.Do(&req, &records)
	})

	if err != nil {
		return nil, err
	}
	log.Debugf("Got all Records, status is %s", records.Status)

	if strings.ToLower(records.Status) == "incomplete" {
		jobRequest := dynectsoap.GetJobRequestType{
			Token:          token,
			Job_id:         records.Job_id,
			Fault_incompat: 0,
		}

		jobResults := dynectsoap.GetJobResponseType{}
		err = apiRetryLoop(func() error {
			return service.GetJobRetry(&jobRequest, &jobResults)
		})
		if err != nil {
			return nil, err
		}
		return jobResults.Data.(*dynectsoap.GetAllRecordsResponseType), nil
	}

	return &records, nil

}
func ( d * dynProviderState ) fetchAllRecordsInZone ( zone string ) ( * dynectsoap . GetAllRecordsResponseType , error ) { var err error client := dynectsoap . NewClient ( " " ) service := dynectsoap . NewDynect ( client ) sessionRequest := dynectsoap . SessionLoginRequestType { Customer_name : d . CustomerName , User_name : d . Username , Password : d . Password , Fault_incompat : 0 , } resp := dynectsoap . SessionLoginResponseType { } err = apiRetryLoop ( func ( ) error { return service . Do ( & sessionRequest , & resp ) } ) if err != nil { return nil , err } token := resp . Data . Token logoutRequest := dynectsoap . SessionLogoutRequestType { Token : token , Fault_incompat : 0 , } logoutResponse := dynectsoap . SessionLogoutResponseType { } defer service . Do ( & logoutRequest , & logoutResponse ) req := dynectsoap . GetAllRecordsRequestType { Token : token , Zone : zone , Fault_incompat : 0 , } records := dynectsoap . GetAllRecordsResponseType { } err = apiRetryLoop ( func ( ) error { return service . Do ( & req , & records ) } ) if err != nil { return nil , err } log . Debugf ( " " , records . Status ) if strings . ToLower ( records . Status ) == " " { jobRequest := dynectsoap . GetJobRequestType { Token : token , Job_id : records . Job_id , Fault_incompat : 0 , } jobResults := dynectsoap . GetJobResponseType { } err = apiRetryLoop ( func ( ) error { return service . GetJobRetry ( & jobRequest , & jobResults ) } ) if err != nil { return nil , err } return jobResults . Data . ( * dynectsoap . GetAllRecordsResponseType ) , nil } return & records , nil }
//Use SOAP to fetch all records with a single call
Use SOAP to fetch all records with a single call