sigs.k8s.io/external-dns@v0.14.1/registry/noop.go (about) 1 /* 2 Copyright 2017 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package registry 18 19 import ( 20 "context" 21 22 "sigs.k8s.io/external-dns/endpoint" 23 "sigs.k8s.io/external-dns/plan" 24 "sigs.k8s.io/external-dns/provider" 25 ) 26 27 // NoopRegistry implements registry interface without ownership directly propagating changes to dns provider 28 type NoopRegistry struct { 29 provider provider.Provider 30 } 31 32 // NewNoopRegistry returns new NoopRegistry object 33 func NewNoopRegistry(provider provider.Provider) (*NoopRegistry, error) { 34 return &NoopRegistry{ 35 provider: provider, 36 }, nil 37 } 38 39 func (im *NoopRegistry) GetDomainFilter() endpoint.DomainFilter { 40 return im.provider.GetDomainFilter() 41 } 42 43 func (im *NoopRegistry) OwnerID() string { 44 return "" 45 } 46 47 // Records returns the current records from the dns provider 48 func (im *NoopRegistry) Records(ctx context.Context) ([]*endpoint.Endpoint, error) { 49 return im.provider.Records(ctx) 50 } 51 52 // ApplyChanges propagates changes to the dns provider 53 func (im *NoopRegistry) ApplyChanges(ctx context.Context, changes *plan.Changes) error { 54 return im.provider.ApplyChanges(ctx, changes) 55 } 56 57 // AdjustEndpoints modifies the endpoints as needed by the specific provider 58 func (im *NoopRegistry) AdjustEndpoints(endpoints []*endpoint.Endpoint) ([]*endpoint.Endpoint, error) { 59 return im.provider.AdjustEndpoints(endpoints) 60 }