provider/pdns.go
func NewPDNSProvider(config PDNSConfig) (*PDNSProvider, error) {

	// Do some input validation

	if config.APIKey == "" {
		return nil, errors.New("Missing API Key for PDNS. Specify using --pdns-api-key=")
	}

	// We do not support dry running, exit safely instead of surprising the user
	// TODO: Add Dry Run support
	if config.DryRun {
		return nil, errors.New("PDNS Provider does not currently support dry-run")
	}

	if config.Server == "localhost" {
		log.Warnf("PDNS Server is set to localhost, this may not be what you want. Specify using --pdns-server=")
	}

	pdnsClientConfig := pgo.NewConfiguration()
	pdnsClientConfig.BasePath = config.Server + apiBase
	if err := config.TLSConfig.setHTTPClient(pdnsClientConfig); err != nil {
		return nil, err
	}

	provider := &PDNSProvider{
		client: &PDNSAPIClient{
			dryRun:       config.DryRun,
			authCtx:      context.WithValue(context.TODO(), pgo.ContextAPIKey, pgo.APIKey{Key: config.APIKey}),
			client:       pgo.NewAPIClient(pdnsClientConfig),
			domainFilter: config.DomainFilter,
		},
	}

	return provider, nil
}
func NewPDNSProvider(config PDNSConfig) (*PDNSProvider, error) {

	// Do some input validation

	if config.APIKey == "" {
		return nil, errors.New("Missing API Key for PDNS. Specify using --pdns-api-key=")
	}

	// We do not support dry running, exit safely instead of surprising the user
	// TODO: Add Dry Run support
	if config.DryRun {
		return nil, errors.New("PDNS Provider does not currently support dry-run")
	}

	if config.Server == "localhost" {
		log.Warnf("PDNS Server is set to localhost, this may not be what you want. Specify using --pdns-server=")
	}

	pdnsClientConfig := pgo.NewConfiguration()
	pdnsClientConfig.BasePath = config.Server + apiBase
	if err := config.TLSConfig.setHTTPClient(pdnsClientConfig); err != nil {
		return nil, err
	}

	provider := &PDNSProvider{
		client: &PDNSAPIClient{
			dryRun:       config.DryRun,
			authCtx:      context.WithValue(context.TODO(), pgo.ContextAPIKey, pgo.APIKey{Key: config.APIKey}),
			client:       pgo.NewAPIClient(pdnsClientConfig),
			domainFilter: config.DomainFilter,
		},
	}

	return provider, nil
}
func NewPDNSProvider ( config PDNSConfig ) ( * PDNSProvider , error ) { // Do some input validation if config . APIKey == " " { return nil , errors . New ( " " ) } // We do not support dry running, exit safely instead of surprising the user // TODO: Add Dry Run support if config . DryRun { return nil , errors . New ( " " ) } if config . Server == " " { log . Warnf ( " " ) } pdnsClientConfig := pgo . NewConfiguration ( ) pdnsClientConfig . BasePath = config . Server + apiBase if err := config . TLSConfig . setHTTPClient ( pdnsClientConfig ) ; err != nil { return nil , err } provider := & PDNSProvider { client : & PDNSAPIClient { dryRun : config . DryRun , authCtx : context . WithValue ( context . TODO ( ) , pgo . ContextAPIKey , pgo . APIKey { Key : config . APIKey } ) , client : pgo . NewAPIClient ( pdnsClientConfig ) , domainFilter : config . DomainFilter , } , } return provider , nil }
// NewPDNSProvider initializes a new PowerDNS based Provider.
NewPDNSProvider initializes a new PowerDNS based Provider .