github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/gcp/gcp_compute_code_generator/basicGcpResource.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 main 16 17 type gcpResourceRenderable interface { 18 getTerraformName() string 19 getAdditionalFields() map[string]string 20 getAllowEmptyValues() []string 21 ifNeedRegion() bool 22 ifNeedZone(zoneInParameters bool) bool 23 ifIDWithZone(zoneInParameters bool) bool 24 getAdditionalFieldsForRefresh() map[string]string 25 } 26 27 type basicGCPResource struct { 28 terraformName string 29 allowEmptyValues []string 30 additionalFields map[string]string 31 additionalFieldsForRefresh map[string]string 32 } 33 34 func (b basicGCPResource) getTerraformName() string { 35 return b.terraformName 36 } 37 38 func (b basicGCPResource) getAdditionalFields() map[string]string { 39 return b.additionalFields 40 } 41 42 func (b basicGCPResource) getAdditionalFieldsForRefresh() map[string]string { 43 return b.additionalFieldsForRefresh 44 } 45 46 func (b basicGCPResource) getAllowEmptyValues() []string { 47 return b.allowEmptyValues 48 } 49 func (b basicGCPResource) ifNeedRegion() bool { 50 return true 51 } 52 53 func (b basicGCPResource) ifNeedZone(zoneInParameters bool) bool { 54 return zoneInParameters 55 } 56 57 func (b basicGCPResource) ifIDWithZone(zoneInParameters bool) bool { 58 return zoneInParameters 59 }