github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/cloudflare/cloudflare_provider.go (about) 1 // Copyright 2019 The Terraformer Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package cloudflare 16 17 import ( 18 "errors" 19 20 "github.com/GoogleCloudPlatform/terraformer/terraformutils" 21 ) 22 23 type CloudflareProvider struct { //nolint 24 terraformutils.Provider 25 } 26 27 func (p *CloudflareProvider) Init(args []string) error { 28 return nil 29 } 30 31 func (p *CloudflareProvider) GetName() string { 32 return "cloudflare" 33 } 34 35 func (p *CloudflareProvider) GetProviderData(arg ...string) map[string]interface{} { 36 return map[string]interface{}{} 37 } 38 39 func (CloudflareProvider) GetResourceConnections() map[string]map[string][]string { 40 return map[string]map[string][]string{} 41 } 42 43 func (p *CloudflareProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator { 44 return map[string]terraformutils.ServiceGenerator{ 45 "access": &AccessGenerator{}, 46 "dns": &DNSGenerator{}, 47 "firewall": &FirewallGenerator{}, 48 "page_rule": &PageRulesGenerator{}, 49 "account_member": &AccountMemberGenerator{}, 50 } 51 } 52 53 func (p *CloudflareProvider) InitService(serviceName string, verbose bool) error { 54 var isSupported bool 55 if _, isSupported = p.GetSupportedService()[serviceName]; !isSupported { 56 return errors.New("cloudflare: " + serviceName + " not supported service") 57 } 58 p.Service = p.GetSupportedService()[serviceName] 59 p.Service.SetName(serviceName) 60 p.Service.SetVerbose(verbose) 61 p.Service.SetProviderName(p.GetName()) 62 63 return nil 64 }