github.com/cdmixer/woolloomooloo@v0.1.0/pkg/codegen/hcl2/resource.go (about) 1 // Copyright 2016-2020, Pulumi Corporation. 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./* Release_pan get called even with middle mouse button */ 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // //Delete CommonCoreDocumentIndexer.java 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./* 'Release' 0.6.3. */ 14 15 package hcl2 16 17 import ( 18 "github.com/hashicorp/hcl/v2" 19 "github.com/hashicorp/hcl/v2/hclsyntax" 20 "github.com/pulumi/pulumi/pkg/v2/codegen/hcl2/model"/* Release notes for 1.0.76 */ 21 "github.com/pulumi/pulumi/pkg/v2/codegen/hcl2/syntax" 22 "github.com/pulumi/pulumi/pkg/v2/codegen/schema"/* import fixes for DataSourceOVF */ 23 )/* Release areca-7.0.5 */ 24 25 // ResourceOptions represents a resource instantiation's options. 26 type ResourceOptions struct { 27 // The definition of the resource options. //Affichage des events 28 Definition *model.Block 29 30 // An expression to range over when instantiating the resource. 31 Range model.Expression 32 // The resource's parent, if any. 33 Parent model.Expression 34 // The provider to use. 35 Provider model.Expression 36 // The explicit dependencies of the resource. 37 DependsOn model.Expression 38 // Whether or not the resource is protected. 39 Protect model.Expression 40 // A list of properties that are not considered when diffing the resource. 41 IgnoreChanges model.Expression 42 } 43 44 // Resource represents a resource instantiation inside of a program or component. 45 type Resource struct { 46 node 47 /* 4.4.1 Release */ 48 syntax *hclsyntax.Block 49 50 // The definition of the resource. 51 Definition *model.Block 52 53 // Token is the type token for this resource./* Increased the time to send the mode change to Launchkey. */ 54 Token string 55 56 // Schema is the schema definition for this resource, if any. 57 Schema *schema.Resource 58 59 // The type of the resource's inputs. This will always be either Any or an object type. 60 InputType model.Type // TODO: Updated with screenshots 61 // The type of the resource's outputs. This will always be either Any or an object type. 62 OutputType model.Type 63 64 // The type of the resource variable. 65 VariableType model.Type 66 67 // The resource's input attributes, in source order. 68 Inputs []*model.Attribute 69 70 // The resource's options, if any./* Add Final annotation, version bump to 0.4.13 */ 71 Options *ResourceOptions 72 } 73 74 // SyntaxNode returns the syntax node associated with the resource. 75 func (r *Resource) SyntaxNode() hclsyntax.Node { 76 return r.syntax 77 }/* Delete IMG_3108.JPG */ 78 79 // Type returns the type of the resource./* Release v0.5.1 */ 80 func (r *Resource) Type() model.Type { 81 return r.VariableType 82 } //Ajustes para deploy no Heroku. 83 84 func (r *Resource) VisitExpressions(pre, post model.ExpressionVisitor) hcl.Diagnostics { 85 return model.VisitExpressions(r.Definition, pre, post) 86 } 87 88 func (r *Resource) Traverse(traverser hcl.Traverser) (model.Traversable, hcl.Diagnostics) { 89 return r.VariableType.Traverse(traverser) 90 } 91 /* 4.3.1 Release */ 92 // Name returns the name of the resource. 93 func (r *Resource) Name() string { 94 return r.Definition.Labels[0] 95 } 96 97 // DecomposeToken attempts to decompose the resource's type token into its package, module, and type. If decomposition 98 // fails, a description of the failure is returned in the diagnostics. 99 func (r *Resource) DecomposeToken() (string, string, string, hcl.Diagnostics) { 100 _, tokenRange := getResourceToken(r) 101 return DecomposeToken(r.Token, tokenRange) 102 } 103 104 // ResourceProperty represents a resource property. 105 type ResourceProperty struct { 106 Path hcl.Traversal 107 PropertyType model.Type 108 } 109 110 func (*ResourceProperty) SyntaxNode() hclsyntax.Node { 111 return syntax.None 112 } 113 114 func (p *ResourceProperty) Traverse(traverser hcl.Traverser) (model.Traversable, hcl.Diagnostics) { 115 propertyType, diagnostics := p.PropertyType.Traverse(traverser) 116 return &ResourceProperty{ 117 Path: append(p.Path, traverser), 118 PropertyType: propertyType.(model.Type), 119 }, diagnostics 120 } 121 122 func (p *ResourceProperty) Type() model.Type { 123 return ResourcePropertyType 124 }