external-dns/pkg/apis/externaldns/validation/validation.go
Peter Huene 3355528c16 Implement Azure DNS provider (#210) (#214)
* vendor Azure Go SDK (#210)

* vendor the Azure Go SDK and dependencies

* add initial Azure DNS provider implementation (#210)

* add 'azure' value to 'provider' command line option
* add 'azure-config-file' command line option
* add 'azure-resource-group' command line option
* implement initial Azure DNS provider

note: azure provider is not yet fully implemented (does not query for existing
records).

tests and documentation are forthcoming.

* add a tutorial for the Azure provider (#210)

* add tutorial for using ExternalDNS with Azure DNS

* finish implementation of Azure DNS provider (#210)

* implement the Records method for the Azure DNS provider

* refactor Azure API interface for future tests (#210)

* make Azure provider use an interface for future unit tests

* add unit tests for the Azure provider (#210)

* test retrieving Azure DNS records.
* test updating and deleting Azure DNS records.
* test dry run for the Azure provider (i.e. noop).
2017-06-02 15:24:52 +02:00

47 lines
1.3 KiB
Go

/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package validation
import (
"errors"
"fmt"
"github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns"
)
// ValidateConfig performs validation on the Config object
func ValidateConfig(cfg *externaldns.Config) error {
// TODO: Should probably return field.ErrorList
if cfg.LogFormat != "text" && cfg.LogFormat != "json" {
return fmt.Errorf("unsupported log format: %s", cfg.LogFormat)
}
if len(cfg.Sources) == 0 {
return errors.New("no sources specified")
}
if cfg.Provider == "" {
return errors.New("no provider specified")
}
// Azure provider specific validations
if cfg.Provider == "azure" {
if cfg.AzureConfigFile == "" {
return errors.New("no Azure config file specified")
}
}
return nil
}