github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/panos/panos_provider.go (about) 1 // Copyright 2018 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 panos 16 17 import ( 18 "errors" 19 20 "github.com/GoogleCloudPlatform/terraformer/terraformutils" 21 "github.com/zclconf/go-cty/cty" 22 ) 23 24 type PanosProvider struct { //nolint 25 terraformutils.Provider 26 vsys string 27 } 28 29 func (p *PanosProvider) Init(args []string) error { 30 p.vsys = args[0] 31 32 return nil 33 } 34 35 func (p *PanosProvider) GetName() string { 36 return "panos" 37 } 38 39 func (p *PanosProvider) GetProviderData(arg ...string) map[string]interface{} { 40 return map[string]interface{}{} 41 } 42 43 func (p *PanosProvider) GetConfig() cty.Value { 44 return cty.ObjectVal(map[string]cty.Value{}) 45 } 46 47 func (p *PanosProvider) GetBasicConfig() cty.Value { 48 return p.GetConfig() 49 } 50 51 func (p *PanosProvider) InitService(serviceName string, verbose bool) error { 52 var isSupported bool 53 if _, isSupported = p.GetSupportedService()[serviceName]; !isSupported { 54 return errors.New(p.GetName() + ": " + serviceName + " not supported service") 55 } 56 57 p.Service = p.GetSupportedService()[serviceName] 58 p.Service.SetName(serviceName) 59 p.Service.SetVerbose(verbose) 60 p.Service.SetProviderName(p.GetName()) 61 p.Service.SetArgs(map[string]interface{}{ 62 "vsys": p.vsys, 63 }) 64 65 return nil 66 } 67 68 func (p *PanosProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator { 69 70 return map[string]terraformutils.ServiceGenerator{ 71 "firewall_device_config": &FirewallDeviceConfigGenerator{}, 72 "firewall_networking": &FirewallNetworkingGenerator{}, 73 "firewall_objects": &FirewallObjectsGenerator{}, 74 "firewall_policy": &FirewallPolicyGenerator{}, 75 "panorama_device_config": &PanoramaDeviceConfigGenerator{}, 76 "panorama_networking": &PanoramaNetworkingGenerator{}, 77 "panorama_objects": &PanoramaObjectsGenerator{}, 78 "panorama_plugins": &PanoramaPluginsGenerator{}, 79 "panorama_policy": &PanoramaPolicyGenerator{}, 80 } 81 } 82 83 func (PanosProvider) GetResourceConnections() map[string]map[string][]string { 84 85 return map[string]map[string][]string{} 86 }