├── .gitignore ├── .travis.yml ├── CHANGES.md ├── LICENSE ├── Makefile ├── README.md ├── bigip ├── config.go ├── provider.go ├── provider_test.go ├── resource_bigip_ltm_irule.go ├── resource_bigip_ltm_irule_test.go ├── resource_bigip_ltm_monitor.go ├── resource_bigip_ltm_monitor_test.go ├── resource_bigip_ltm_node.go ├── resource_bigip_ltm_node_test.go ├── resource_bigip_ltm_policy.go ├── resource_bigip_ltm_policy_test.go ├── resource_bigip_ltm_pool.go ├── resource_bigip_ltm_pool_test.go ├── resource_bigip_ltm_virtual_address.go ├── resource_bigip_ltm_virtual_address_test.go ├── resource_bigip_ltm_virtual_server.go ├── resource_bigip_ltm_virtual_server_test.go ├── validators.go └── validators_test.go ├── main.go └── vendor ├── github.com ├── apparentlymart │ └── go-cidr │ │ ├── LICENSE │ │ └── cidr │ │ ├── cidr.go │ │ └── wrangling.go ├── aws │ └── aws-sdk-go │ │ ├── LICENSE.txt │ │ ├── NOTICE.txt │ │ ├── aws │ │ ├── awserr │ │ │ ├── error.go │ │ │ └── types.go │ │ ├── awsutil │ │ │ ├── copy.go │ │ │ ├── equal.go │ │ │ ├── path_value.go │ │ │ ├── prettify.go │ │ │ └── string_value.go │ │ ├── client │ │ │ ├── client.go │ │ │ ├── default_retryer.go │ │ │ └── metadata │ │ │ │ └── client_info.go │ │ ├── config.go │ │ ├── convert_types.go │ │ ├── corehandlers │ │ │ ├── handlers.go │ │ │ └── param_validator.go │ │ ├── credentials │ │ │ ├── chain_provider.go │ │ │ ├── credentials.go │ │ │ ├── ec2rolecreds │ │ │ │ └── ec2_role_provider.go │ │ │ ├── endpointcreds │ │ │ │ └── provider.go │ │ │ ├── env_provider.go │ │ │ ├── example.ini │ │ │ ├── shared_credentials_provider.go │ │ │ ├── static_provider.go │ │ │ └── stscreds │ │ │ │ └── assume_role_provider.go │ │ ├── defaults │ │ │ └── defaults.go │ │ ├── ec2metadata │ │ │ ├── api.go │ │ │ └── service.go │ │ ├── errors.go │ │ ├── logger.go │ │ ├── request │ │ │ ├── handlers.go │ │ │ ├── http_request.go │ │ │ ├── offset_reader.go │ │ │ ├── request.go │ │ │ ├── request_pagination.go │ │ │ ├── retryer.go │ │ │ └── validation.go │ │ ├── session │ │ │ ├── doc.go │ │ │ ├── env_config.go │ │ │ ├── session.go │ │ │ └── shared_config.go │ │ ├── signer │ │ │ └── v4 │ │ │ │ ├── header_rules.go │ │ │ │ ├── uri_path.go │ │ │ │ ├── uri_path_1_4.go │ │ │ │ └── v4.go │ │ ├── types.go │ │ └── version.go │ │ ├── private │ │ ├── endpoints │ │ │ ├── endpoints.go │ │ │ ├── endpoints.json │ │ │ └── endpoints_map.go │ │ ├── protocol │ │ │ ├── idempotency.go │ │ │ ├── query │ │ │ │ ├── build.go │ │ │ │ ├── queryutil │ │ │ │ │ └── queryutil.go │ │ │ │ ├── unmarshal.go │ │ │ │ └── unmarshal_error.go │ │ │ ├── rest │ │ │ │ ├── build.go │ │ │ │ ├── payload.go │ │ │ │ └── unmarshal.go │ │ │ ├── restxml │ │ │ │ └── restxml.go │ │ │ ├── unmarshal.go │ │ │ └── xml │ │ │ │ └── xmlutil │ │ │ │ ├── build.go │ │ │ │ ├── unmarshal.go │ │ │ │ └── xml_to_struct.go │ │ └── waiter │ │ │ └── waiter.go │ │ └── service │ │ ├── s3 │ │ ├── api.go │ │ ├── bucket_location.go │ │ ├── content_md5.go │ │ ├── customizations.go │ │ ├── host_style_bucket.go │ │ ├── platform_handlers.go │ │ ├── platform_handlers_go1.6.go │ │ ├── service.go │ │ ├── sse.go │ │ ├── statusok_error.go │ │ ├── unmarshal_error.go │ │ └── waiters.go │ │ └── sts │ │ ├── api.go │ │ ├── customizations.go │ │ └── service.go ├── bgentry │ └── go-netrc │ │ ├── LICENSE │ │ └── netrc │ │ └── netrc.go ├── davecgh │ └── go-spew │ │ ├── LICENSE │ │ └── spew │ │ ├── bypass.go │ │ ├── bypasssafe.go │ │ ├── common.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── dump.go │ │ ├── format.go │ │ └── spew.go ├── go-ini │ └── ini │ │ ├── LICENSE │ │ ├── README.md │ │ ├── README_ZH.md │ │ ├── ini.go │ │ ├── parser.go │ │ └── struct.go ├── hashicorp │ ├── errwrap │ │ ├── LICENSE │ │ ├── README.md │ │ └── errwrap.go │ ├── go-getter │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── client.go │ │ ├── client_mode.go │ │ ├── copy_dir.go │ │ ├── decompress.go │ │ ├── decompress_bzip2.go │ │ ├── decompress_gzip.go │ │ ├── decompress_tbz2.go │ │ ├── decompress_testing.go │ │ ├── decompress_tgz.go │ │ ├── decompress_zip.go │ │ ├── detect.go │ │ ├── detect_bitbucket.go │ │ ├── detect_file.go │ │ ├── detect_github.go │ │ ├── detect_s3.go │ │ ├── folder_storage.go │ │ ├── get.go │ │ ├── get_file.go │ │ ├── get_file_unix.go │ │ ├── get_file_windows.go │ │ ├── get_git.go │ │ ├── get_hg.go │ │ ├── get_http.go │ │ ├── get_mock.go │ │ ├── get_s3.go │ │ ├── helper │ │ │ └── url │ │ │ │ ├── url.go │ │ │ │ ├── url_unix.go │ │ │ │ └── url_windows.go │ │ ├── netrc.go │ │ ├── source.go │ │ └── storage.go │ ├── go-multierror │ │ ├── LICENSE │ │ ├── README.md │ │ ├── append.go │ │ ├── flatten.go │ │ ├── format.go │ │ ├── multierror.go │ │ └── prefix.go │ ├── go-plugin │ │ ├── LICENSE │ │ ├── README.md │ │ ├── client.go │ │ ├── discover.go │ │ ├── error.go │ │ ├── mux_broker.go │ │ ├── plugin.go │ │ ├── process.go │ │ ├── process_posix.go │ │ ├── process_windows.go │ │ ├── rpc_client.go │ │ ├── rpc_server.go │ │ ├── server.go │ │ ├── server_mux.go │ │ ├── stream.go │ │ └── testing.go │ ├── go-uuid │ │ ├── LICENSE │ │ ├── README.md │ │ └── uuid.go │ ├── go-version │ │ ├── LICENSE │ │ ├── README.md │ │ ├── constraint.go │ │ ├── version.go │ │ └── version_collection.go │ ├── hcl │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── decoder.go │ │ ├── hcl.go │ │ ├── hcl │ │ │ ├── ast │ │ │ │ ├── ast.go │ │ │ │ └── walk.go │ │ │ ├── parser │ │ │ │ ├── error.go │ │ │ │ └── parser.go │ │ │ ├── scanner │ │ │ │ └── scanner.go │ │ │ ├── strconv │ │ │ │ └── quote.go │ │ │ └── token │ │ │ │ ├── position.go │ │ │ │ └── token.go │ │ ├── json │ │ │ ├── parser │ │ │ │ ├── flatten.go │ │ │ │ └── parser.go │ │ │ ├── scanner │ │ │ │ └── scanner.go │ │ │ └── token │ │ │ │ ├── position.go │ │ │ │ └── token.go │ │ ├── lex.go │ │ └── parse.go │ ├── hil │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── ast │ │ │ ├── arithmetic.go │ │ │ ├── arithmetic_op.go │ │ │ ├── ast.go │ │ │ ├── call.go │ │ │ ├── index.go │ │ │ ├── literal.go │ │ │ ├── output.go │ │ │ ├── scope.go │ │ │ ├── stack.go │ │ │ ├── type_string.go │ │ │ ├── unknown.go │ │ │ ├── variable_access.go │ │ │ └── variables_helper.go │ │ ├── builtins.go │ │ ├── check_identifier.go │ │ ├── check_types.go │ │ ├── convert.go │ │ ├── eval.go │ │ ├── eval_type.go │ │ ├── evaltype_string.go │ │ ├── parse.go │ │ ├── parser │ │ │ ├── binary_op.go │ │ │ ├── error.go │ │ │ ├── fuzz.go │ │ │ └── parser.go │ │ ├── scanner │ │ │ ├── peeker.go │ │ │ ├── scanner.go │ │ │ ├── token.go │ │ │ └── tokentype_string.go │ │ ├── transform_fixed.go │ │ └── walk.go │ ├── logutils │ │ ├── LICENSE │ │ ├── README.md │ │ └── level.go │ ├── terraform │ │ ├── LICENSE │ │ ├── config │ │ │ ├── append.go │ │ │ ├── config.go │ │ │ ├── config_string.go │ │ │ ├── config_tree.go │ │ │ ├── import_tree.go │ │ │ ├── interpolate.go │ │ │ ├── interpolate_funcs.go │ │ │ ├── interpolate_walk.go │ │ │ ├── lang.go │ │ │ ├── loader.go │ │ │ ├── loader_hcl.go │ │ │ ├── merge.go │ │ │ ├── module │ │ │ │ ├── copy_dir.go │ │ │ │ ├── get.go │ │ │ │ ├── inode.go │ │ │ │ ├── inode_freebsd.go │ │ │ │ ├── inode_windows.go │ │ │ │ ├── module.go │ │ │ │ ├── tree.go │ │ │ │ └── tree_gob.go │ │ │ ├── raw_config.go │ │ │ ├── resource_mode.go │ │ │ ├── resource_mode_string.go │ │ │ └── testing.go │ │ ├── dag │ │ │ ├── dag.go │ │ │ ├── dot.go │ │ │ ├── edge.go │ │ │ ├── graph.go │ │ │ ├── marshal.go │ │ │ ├── set.go │ │ │ └── tarjan.go │ │ ├── flatmap │ │ │ ├── expand.go │ │ │ ├── flatten.go │ │ │ └── map.go │ │ ├── helper │ │ │ ├── config │ │ │ │ ├── decode.go │ │ │ │ └── validator.go │ │ │ ├── experiment │ │ │ │ ├── experiment.go │ │ │ │ └── id.go │ │ │ ├── hashcode │ │ │ │ └── hashcode.go │ │ │ ├── hilmapstructure │ │ │ │ └── hilmapstructure.go │ │ │ ├── logging │ │ │ │ └── logging.go │ │ │ ├── resource │ │ │ │ ├── error.go │ │ │ │ ├── id.go │ │ │ │ ├── map.go │ │ │ │ ├── resource.go │ │ │ │ ├── state.go │ │ │ │ ├── testing.go │ │ │ │ ├── testing_config.go │ │ │ │ ├── testing_import_state.go │ │ │ │ └── wait.go │ │ │ ├── schema │ │ │ │ ├── README.md │ │ │ │ ├── data_source_resource_shim.go │ │ │ │ ├── equal.go │ │ │ │ ├── field_reader.go │ │ │ │ ├── field_reader_config.go │ │ │ │ ├── field_reader_diff.go │ │ │ │ ├── field_reader_map.go │ │ │ │ ├── field_reader_multi.go │ │ │ │ ├── field_writer.go │ │ │ │ ├── field_writer_map.go │ │ │ │ ├── getsource_string.go │ │ │ │ ├── provider.go │ │ │ │ ├── resource.go │ │ │ │ ├── resource_data.go │ │ │ │ ├── resource_data_get_source.go │ │ │ │ ├── resource_importer.go │ │ │ │ ├── schema.go │ │ │ │ ├── serialize.go │ │ │ │ ├── set.go │ │ │ │ ├── valuetype.go │ │ │ │ └── valuetype_string.go │ │ │ └── shadow │ │ │ │ ├── closer.go │ │ │ │ ├── compared_value.go │ │ │ │ ├── keyed_value.go │ │ │ │ ├── ordered_value.go │ │ │ │ └── value.go │ │ ├── plugin │ │ │ ├── plugin.go │ │ │ ├── resource_provider.go │ │ │ ├── resource_provisioner.go │ │ │ ├── serve.go │ │ │ ├── ui_input.go │ │ │ └── ui_output.go │ │ └── terraform │ │ │ ├── context.go │ │ │ ├── context_components.go │ │ │ ├── context_import.go │ │ │ ├── debug.go │ │ │ ├── diff.go │ │ │ ├── edge_destroy.go │ │ │ ├── eval.go │ │ │ ├── eval_apply.go │ │ │ ├── eval_check_prevent_destroy.go │ │ │ ├── eval_context.go │ │ │ ├── eval_context_builtin.go │ │ │ ├── eval_context_mock.go │ │ │ ├── eval_count.go │ │ │ ├── eval_count_boundary.go │ │ │ ├── eval_count_computed.go │ │ │ ├── eval_diff.go │ │ │ ├── eval_error.go │ │ │ ├── eval_filter.go │ │ │ ├── eval_filter_operation.go │ │ │ ├── eval_if.go │ │ │ ├── eval_import_state.go │ │ │ ├── eval_interpolate.go │ │ │ ├── eval_noop.go │ │ │ ├── eval_output.go │ │ │ ├── eval_provider.go │ │ │ ├── eval_provisioner.go │ │ │ ├── eval_read_data.go │ │ │ ├── eval_refresh.go │ │ │ ├── eval_resource.go │ │ │ ├── eval_sequence.go │ │ │ ├── eval_state.go │ │ │ ├── eval_validate.go │ │ │ ├── eval_variable.go │ │ │ ├── evaltree_provider.go │ │ │ ├── graph.go │ │ │ ├── graph_builder.go │ │ │ ├── graph_builder_apply.go │ │ │ ├── graph_builder_destroy_plan.go │ │ │ ├── graph_builder_import.go │ │ │ ├── graph_builder_plan.go │ │ │ ├── graph_config_node.go │ │ │ ├── graph_config_node_module.go │ │ │ ├── graph_config_node_output.go │ │ │ ├── graph_config_node_provider.go │ │ │ ├── graph_config_node_resource.go │ │ │ ├── graph_config_node_type.go │ │ │ ├── graph_config_node_variable.go │ │ │ ├── graph_dot.go │ │ │ ├── graph_interface_subgraph.go │ │ │ ├── graph_walk.go │ │ │ ├── graph_walk_context.go │ │ │ ├── graph_walk_operation.go │ │ │ ├── graphnodeconfigtype_string.go │ │ │ ├── hook.go │ │ │ ├── hook_mock.go │ │ │ ├── hook_stop.go │ │ │ ├── instancetype.go │ │ │ ├── instancetype_string.go │ │ │ ├── interpolate.go │ │ │ ├── node_count_boundary.go │ │ │ ├── node_module_destroy.go │ │ │ ├── node_module_variable.go │ │ │ ├── node_output.go │ │ │ ├── node_output_orphan.go │ │ │ ├── node_provider.go │ │ │ ├── node_provider_abstract.go │ │ │ ├── node_provider_disabled.go │ │ │ ├── node_resource_abstract.go │ │ │ ├── node_resource_apply.go │ │ │ ├── node_resource_destroy.go │ │ │ ├── node_resource_plan.go │ │ │ ├── node_resource_plan_destroy.go │ │ │ ├── node_resource_plan_instance.go │ │ │ ├── node_resource_plan_orphan.go │ │ │ ├── node_root_variable.go │ │ │ ├── path.go │ │ │ ├── plan.go │ │ │ ├── resource.go │ │ │ ├── resource_address.go │ │ │ ├── resource_provider.go │ │ │ ├── resource_provider_mock.go │ │ │ ├── resource_provisioner.go │ │ │ ├── resource_provisioner_mock.go │ │ │ ├── semantics.go │ │ │ ├── shadow.go │ │ │ ├── shadow_components.go │ │ │ ├── shadow_context.go │ │ │ ├── shadow_resource_provider.go │ │ │ ├── shadow_resource_provisioner.go │ │ │ ├── state.go │ │ │ ├── state_add.go │ │ │ ├── state_filter.go │ │ │ ├── state_upgrade_v1_to_v2.go │ │ │ ├── state_upgrade_v2_to_v3.go │ │ │ ├── state_v1.go │ │ │ ├── transform.go │ │ │ ├── transform_attach_config_provider.go │ │ │ ├── transform_attach_config_resource.go │ │ │ ├── transform_attach_state.go │ │ │ ├── transform_config.go │ │ │ ├── transform_config_flat.go │ │ │ ├── transform_config_old.go │ │ │ ├── transform_count_boundary.go │ │ │ ├── transform_deposed.go │ │ │ ├── transform_destroy.go │ │ │ ├── transform_destroy_cbd.go │ │ │ ├── transform_destroy_edge.go │ │ │ ├── transform_diff.go │ │ │ ├── transform_expand.go │ │ │ ├── transform_flatten.go │ │ │ ├── transform_import_provider.go │ │ │ ├── transform_import_state.go │ │ │ ├── transform_module_destroy_old.go │ │ │ ├── transform_module_variable.go │ │ │ ├── transform_noop.go │ │ │ ├── transform_orphan.go │ │ │ ├── transform_orphan_count.go │ │ │ ├── transform_orphan_output.go │ │ │ ├── transform_orphan_resource.go │ │ │ ├── transform_output.go │ │ │ ├── transform_output_orphan.go │ │ │ ├── transform_provider.go │ │ │ ├── transform_provider_disable.go │ │ │ ├── transform_provider_old.go │ │ │ ├── transform_provisioner.go │ │ │ ├── transform_proxy.go │ │ │ ├── transform_reference.go │ │ │ ├── transform_resource.go │ │ │ ├── transform_resource_count.go │ │ │ ├── transform_root.go │ │ │ ├── transform_state.go │ │ │ ├── transform_targets.go │ │ │ ├── transform_transitive_reduction.go │ │ │ ├── transform_variable.go │ │ │ ├── transform_vertex.go │ │ │ ├── ui_input.go │ │ │ ├── ui_input_mock.go │ │ │ ├── ui_input_prefix.go │ │ │ ├── ui_output.go │ │ │ ├── ui_output_callback.go │ │ │ ├── ui_output_mock.go │ │ │ ├── ui_output_provisioner.go │ │ │ ├── util.go │ │ │ ├── variables.go │ │ │ ├── version.go │ │ │ ├── version_required.go │ │ │ └── walkoperation_string.go │ └── yamux │ │ ├── LICENSE │ │ ├── README.md │ │ ├── addr.go │ │ ├── const.go │ │ ├── mux.go │ │ ├── session.go │ │ ├── spec.md │ │ ├── stream.go │ │ └── util.go ├── jmespath │ └── go-jmespath │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── api.go │ │ ├── astnodetype_string.go │ │ ├── functions.go │ │ ├── interpreter.go │ │ ├── lexer.go │ │ ├── parser.go │ │ ├── toktype_string.go │ │ └── util.go ├── mitchellh │ ├── copystructure │ │ ├── LICENSE │ │ ├── README.md │ │ ├── copier_time.go │ │ └── copystructure.go │ ├── go-homedir │ │ ├── LICENSE │ │ ├── README.md │ │ └── homedir.go │ ├── mapstructure │ │ ├── LICENSE │ │ ├── README.md │ │ ├── decode_hooks.go │ │ ├── error.go │ │ └── mapstructure.go │ └── reflectwalk │ │ ├── LICENSE │ │ ├── README.md │ │ ├── location.go │ │ ├── location_string.go │ │ └── reflectwalk.go ├── pmezard │ └── go-difflib │ │ ├── LICENSE │ │ └── difflib │ │ └── difflib.go ├── satori │ └── go.uuid │ │ ├── LICENSE │ │ ├── README.md │ │ └── uuid.go ├── scottdware │ └── go-bigip │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bigip.go │ │ ├── ltm.go │ │ └── net.go └── stretchr │ └── testify │ ├── LICENSE │ └── assert │ ├── assertion_forward.go │ ├── assertion_forward.go.tmpl │ ├── assertions.go │ ├── doc.go │ ├── errors.go │ ├── forward_assertions.go │ └── http_assertions.go └── vendor.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.tfstate* 2 | .idea/ 3 | bin/ 4 | target/ 5 | #test files 6 | bigip.test 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | 4 | go: 5 | - 1.8 6 | 7 | before_install: 8 | - go get github.com/mitchellh/gox 9 | 10 | script: 11 | - make bin 12 | 13 | after_success: 14 | - make dist 15 | 16 | deploy: 17 | provider: releases 18 | api_key: 19 | secure: pu+/NBPKLM+6sl76GzuIxsmsp2LBEUY0y2UXEoAVtrY52WbybBtJW8HB+Vqx1QJEdSJCQ48QonkGB5H7M3FuLy9BjCJHm+Na0L3TPoYxMAGtkUWUzz/sErRRQarOJ3HxJCdiBNKZHaY9yPlHYpPYYVO7vgWV8EppP9LuVT7tUW3KRkqqURKqYPfV9hlfBZ1Ik6QB8vqophzZuPWHHqWF2249wO06Lr9B0QV907Cum6RCFOOTzqmwDgc1V0f6JePIOq9RmnkFiSdmTGi+fGFHbkVomjbGE1HR8vPO1XVbRZ3AYQnA1eGKpfjBzWn0NSmcPh79UQRohC3luAHJRIKBuGmDc6dm1dmFh3nicq8T565Vupxxq1YxVG4S3wdr+apk1vM6pA+eHk0l+n1OdTSFmYhFygt6YDx5OWKhCgQyvtYBW3tsMIe7WtfOrkZotFzeQczQoE0mZ7vTW70zPzjnnA2KbDTMdX83cQ0vqZEuufTDFBQ/rbK7CZeAk82rJ4SaLHeCcxcLaDKQobKEYmVtsqA4OIqejQpjqerQK0dg5L8r6e8YJT4jLuEGpktNPGsiOQXNvnU7gChsQRj2Rq2GzU4EvUfCQ1mKjzzFNyT5mkfGUUvBRWytyuwfrSTAbvIGprCg56/x8W7CElSK3ZTbSpZnQqnVicmLZYwYinTTe+4= 20 | file_glob: true 21 | file: "target/pkg/*.tar.gz" 22 | on: 23 | tags: true 24 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | # NEXT 2 | 3 | - iRule creation support 4 | - **Breaking Change** - rules property on bigip_ltm_virtual_server renamed to irules 5 | 6 | # 0.2.0 7 | 8 | - Added profiles, irules, source_address_translation to virtual servers 9 | - Cleaned up handling of lists 10 | 11 | # 0.1.0 12 | 13 | - Initial release -------------------------------------------------------------------------------- /bigip/config.go: -------------------------------------------------------------------------------- 1 | package bigip 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/scottdware/go-bigip" 8 | ) 9 | 10 | type Config struct { 11 | Address string 12 | Username string 13 | Password string 14 | LoginReference string 15 | ConfigOptions *bigip.ConfigOptions 16 | } 17 | 18 | func (c *Config) Client() (*bigip.BigIP, error) { 19 | 20 | if c.Address != "" && c.Username != "" && c.Password != "" { 21 | log.Println("[INFO] Initializing BigIP connection") 22 | var client *bigip.BigIP 23 | var err error 24 | if c.LoginReference != "" { 25 | client, err = bigip.NewTokenSession(c.Address, c.Username, c.Password, c.LoginReference, c.ConfigOptions) 26 | if err != nil { 27 | return nil, err 28 | } 29 | } else { 30 | client = bigip.NewSession(c.Address, c.Username, c.Password, c.ConfigOptions) 31 | } 32 | err = c.validateConnection(client) 33 | if err == nil { 34 | return client, nil 35 | } 36 | return nil, err 37 | } 38 | return nil, fmt.Errorf("BigIP provider requires address, username and password") 39 | } 40 | 41 | func (c *Config) validateConnection(client *bigip.BigIP) error { 42 | _, err := client.SelfIPs() 43 | if err != nil { 44 | return err 45 | } 46 | return nil 47 | } 48 | -------------------------------------------------------------------------------- /bigip/provider_test.go: -------------------------------------------------------------------------------- 1 | package bigip 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/hashicorp/terraform/helper/schema" 7 | "github.com/hashicorp/terraform/terraform" 8 | "os" 9 | ) 10 | 11 | var TEST_PARTITION = "Common" 12 | 13 | var testAccProviders map[string]terraform.ResourceProvider 14 | var testAccProvider *schema.Provider 15 | 16 | func init() { 17 | testAccProvider = Provider().(*schema.Provider) 18 | testAccProviders = map[string]terraform.ResourceProvider{ 19 | "bigip": testAccProvider, 20 | } 21 | if v := os.Getenv("BIGIP_TEST_PARTITION"); v != "" { 22 | TEST_PARTITION = v 23 | } 24 | } 25 | 26 | func TestProvider(t *testing.T) { 27 | if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 28 | t.Fatalf("err: %s", err) 29 | } 30 | } 31 | 32 | func testAcctPreCheck(t *testing.T) { 33 | if os.Getenv("BIGIP_TOKEN_AUTH") != "" && os.Getenv("BIGIP_LOGIN_REF") != "" { 34 | return 35 | } 36 | for _, s := range [...]string{"BIGIP_HOST", "BIGIP_USER", "BIGIP_PASSWORD"} { 37 | if os.Getenv(s) == "" { 38 | t.Fatal("Either BIGIP_TOKEN_AUTH + BIGIP_LOGIN_REF or BIGIP_USER, BIGIP_PASSWORD and BIGIP_HOST are required for tests.") 39 | return 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bigip/validators.go: -------------------------------------------------------------------------------- 1 | package bigip 2 | 3 | import ( 4 | "fmt" 5 | "github.com/hashicorp/terraform/helper/schema" 6 | "reflect" 7 | "regexp" 8 | ) 9 | 10 | //Validate the incoming set only contains values from the specified set 11 | func validateSetValues(valid *schema.Set) schema.SchemaValidateFunc { 12 | return func(value interface{}, field string) (ws []string, errors []error) { 13 | if valid.Intersection(value.(*schema.Set)).Len() != value.(*schema.Set).Len() { 14 | errors = append(errors, fmt.Errorf("%q can only contain %v", field, value.(*schema.Set).List())) 15 | } 16 | return 17 | } 18 | } 19 | 20 | func validateStringValue(values []string) schema.SchemaValidateFunc { 21 | return func(value interface{}, field string) (ws []string, errors []error) { 22 | for _, v := range values { 23 | if v == value.(string) { 24 | return 25 | } 26 | } 27 | errors = append(errors, fmt.Errorf("%q must be one of %v", field, values)) 28 | return 29 | } 30 | } 31 | 32 | func validateF5Name(value interface{}, field string) (ws []string, errors []error) { 33 | var values []string 34 | switch value.(type) { 35 | case *schema.Set: 36 | values = setToStringSlice(value.(*schema.Set)) 37 | break 38 | case []string: 39 | values = value.([]string) 40 | break 41 | case *[]string: 42 | values = *(value.(*[]string)) 43 | break 44 | case string: 45 | values = []string{value.(string)} 46 | break 47 | default: 48 | errors = append(errors, fmt.Errorf("Unknown type %v in validateF5Name", reflect.TypeOf(value))) 49 | } 50 | 51 | for _, v := range values { 52 | match, _ := regexp.MatchString("^/[\\w_\\-.]+/[\\w_\\-.]+$", v) 53 | if !match { 54 | errors = append(errors, fmt.Errorf("%q must match /Partition/Name and contain letters, numbers or [._-]. e.g. /Common/my-pool", field)) 55 | } 56 | } 57 | return 58 | } 59 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/DealerDotCom/terraform-provider-bigip/bigip" 5 | "github.com/hashicorp/terraform/plugin" 6 | ) 7 | 8 | func main() { 9 | plugin.Serve(&plugin.ServeOpts{ 10 | ProviderFunc: bigip.Provider, 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/apparentlymart/go-cidr/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Martin Atkins 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go: -------------------------------------------------------------------------------- 1 | package cidr 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | "net" 7 | ) 8 | 9 | func ipToInt(ip net.IP) (*big.Int, int) { 10 | val := &big.Int{} 11 | val.SetBytes([]byte(ip)) 12 | if len(ip) == net.IPv4len { 13 | return val, 32 14 | } else if len(ip) == net.IPv6len { 15 | return val, 128 16 | } else { 17 | panic(fmt.Errorf("Unsupported address length %d", len(ip))) 18 | } 19 | } 20 | 21 | func intToIP(ipInt *big.Int, bits int) net.IP { 22 | ipBytes := ipInt.Bytes() 23 | ret := make([]byte, bits/8) 24 | // Pack our IP bytes into the end of the return array, 25 | // since big.Int.Bytes() removes front zero padding. 26 | for i := 1; i <= len(ipBytes); i++ { 27 | ret[len(ret)-i] = ipBytes[len(ipBytes)-i] 28 | } 29 | return net.IP(ret) 30 | } 31 | 32 | func insertNumIntoIP(ip net.IP, num int, prefixLen int) net.IP { 33 | ipInt, totalBits := ipToInt(ip) 34 | bigNum := big.NewInt(int64(num)) 35 | bigNum.Lsh(bigNum, uint(totalBits-prefixLen)) 36 | ipInt.Or(ipInt, bigNum) 37 | return intToIP(ipInt, totalBits) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Go 2 | Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Copyright 2014-2015 Stripe, Inc. 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | // DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. 8 | // In addition to this, this method will also dereference the input values if 9 | // possible so the DeepEqual performed will not fail if one parameter is a 10 | // pointer and the other is not. 11 | // 12 | // DeepEqual will not perform indirection of nested values of the input parameters. 13 | func DeepEqual(a, b interface{}) bool { 14 | ra := reflect.Indirect(reflect.ValueOf(a)) 15 | rb := reflect.Indirect(reflect.ValueOf(b)) 16 | 17 | if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { 18 | // If the elements are both nil, and of the same type the are equal 19 | // If they are of different types they are not equal 20 | return reflect.TypeOf(a) == reflect.TypeOf(b) 21 | } else if raValid != rbValid { 22 | // Both values must be valid to be equal 23 | return false 24 | } 25 | 26 | return reflect.DeepEqual(ra.Interface(), rb.Interface()) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | // ClientInfo wraps immutable data from the client.Client structure. 4 | type ClientInfo struct { 5 | ServiceName string 6 | APIVersion string 7 | Endpoint string 8 | SigningName string 9 | SigningRegion string 10 | JSONVersion string 11 | TargetPrefix string 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go: -------------------------------------------------------------------------------- 1 | package corehandlers 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | // ValidateParametersHandler is a request handler to validate the input parameters. 6 | // Validating parameters only has meaning if done prior to the request being sent. 7 | var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { 8 | if !r.ParamsFilled() { 9 | return 10 | } 11 | 12 | if v, ok := r.Params.(request.Validator); ok { 13 | if err := v.Validate(); err != nil { 14 | r.Error = err 15 | } 16 | } 17 | }} 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id = accessKey 3 | aws_secret_access_key = secret 4 | aws_session_token = token 5 | 6 | [no_token] 7 | aws_access_key_id = accessKey 8 | aws_secret_access_key = secret 9 | 10 | [with_colon] 11 | aws_access_key_id: accessKey 12 | aws_secret_access_key: secret 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/errors.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import "github.com/aws/aws-sdk-go/aws/awserr" 4 | 5 | var ( 6 | // ErrMissingRegion is an error that is returned if region configuration is 7 | // not found. 8 | // 9 | // @readonly 10 | ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) 11 | 12 | // ErrMissingEndpoint is an error that is returned if an endpoint cannot be 13 | // resolved for a service. 14 | // 15 | // @readonly 16 | ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | "net/url" 7 | ) 8 | 9 | func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { 10 | req := new(http.Request) 11 | *req = *r 12 | req.URL = &url.URL{} 13 | *req.URL = *r.URL 14 | req.Body = body 15 | 16 | req.Header = http.Header{} 17 | for k, v := range r.Header { 18 | for _, vv := range v { 19 | req.Header.Add(k, vv) 20 | } 21 | } 22 | 23 | return req 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | ) 7 | 8 | // offsetReader is a thread-safe io.ReadCloser to prevent racing 9 | // with retrying requests 10 | type offsetReader struct { 11 | buf io.ReadSeeker 12 | lock sync.Mutex 13 | closed bool 14 | } 15 | 16 | func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { 17 | reader := &offsetReader{} 18 | buf.Seek(offset, 0) 19 | 20 | reader.buf = buf 21 | return reader 22 | } 23 | 24 | // Close will close the instance of the offset reader's access to 25 | // the underlying io.ReadSeeker. 26 | func (o *offsetReader) Close() error { 27 | o.lock.Lock() 28 | defer o.lock.Unlock() 29 | o.closed = true 30 | return nil 31 | } 32 | 33 | // Read is a thread-safe read of the underlying io.ReadSeeker 34 | func (o *offsetReader) Read(p []byte) (int, error) { 35 | o.lock.Lock() 36 | defer o.lock.Unlock() 37 | 38 | if o.closed { 39 | return 0, io.EOF 40 | } 41 | 42 | return o.buf.Read(p) 43 | } 44 | 45 | // Seek is a thread-safe seeking operation. 46 | func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { 47 | o.lock.Lock() 48 | defer o.lock.Unlock() 49 | 50 | return o.buf.Seek(offset, whence) 51 | } 52 | 53 | // CloseAndCopy will return a new offsetReader with a copy of the old buffer 54 | // and close the old buffer. 55 | func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { 56 | o.Close() 57 | return newOffsetReader(o.buf, offset) 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package v4 4 | 5 | import ( 6 | "net/url" 7 | "strings" 8 | ) 9 | 10 | func getURIPath(u *url.URL) string { 11 | var uri string 12 | 13 | if len(u.Opaque) > 0 { 14 | uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") 15 | } else { 16 | uri = u.EscapedPath() 17 | } 18 | 19 | if len(uri) == 0 { 20 | uri = "/" 21 | } 22 | 23 | return uri 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path_1_4.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | package v4 4 | 5 | import ( 6 | "net/url" 7 | "strings" 8 | ) 9 | 10 | func getURIPath(u *url.URL) string { 11 | var uri string 12 | 13 | if len(u.Opaque) > 0 { 14 | uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") 15 | } else { 16 | uri = u.Path 17 | } 18 | 19 | if len(uri) == 0 { 20 | uri = "/" 21 | } 22 | 23 | return uri 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/version.go: -------------------------------------------------------------------------------- 1 | // Package aws provides core functionality for making requests to AWS services. 2 | package aws 3 | 4 | // SDKName is the name of this AWS SDK 5 | const SDKName = "aws-sdk-go" 6 | 7 | // SDKVersion is the version of this SDK 8 | const SDKVersion = "1.5.8" 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go: -------------------------------------------------------------------------------- 1 | // Package query provides serialization of AWS query requests, and responses. 2 | package query 3 | 4 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go 5 | 6 | import ( 7 | "net/url" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building query protocol requests 15 | var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} 16 | 17 | // Build builds a request for an AWS Query service. 18 | func Build(r *request.Request) { 19 | body := url.Values{ 20 | "Action": {r.Operation.Name}, 21 | "Version": {r.ClientInfo.APIVersion}, 22 | } 23 | if err := queryutil.Parse(body, r.Params, false); err != nil { 24 | r.Error = awserr.New("SerializationError", "failed encoding Query request", err) 25 | return 26 | } 27 | 28 | if r.ExpireTime == 0 { 29 | r.HTTPRequest.Method = "POST" 30 | r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") 31 | r.SetBufferBody([]byte(body.Encode())) 32 | } else { // This is a pre-signed request 33 | r.HTTPRequest.Method = "GET" 34 | r.HTTPRequest.URL.RawQuery = body.Encode() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go 4 | 5 | import ( 6 | "encoding/xml" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" 11 | ) 12 | 13 | // UnmarshalHandler is a named request handler for unmarshaling query protocol requests 14 | var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} 15 | 16 | // UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata 17 | var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} 18 | 19 | // Unmarshal unmarshals a response for an AWS Query service. 20 | func Unmarshal(r *request.Request) { 21 | defer r.HTTPResponse.Body.Close() 22 | if r.DataFilled() { 23 | decoder := xml.NewDecoder(r.HTTPResponse.Body) 24 | err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") 25 | if err != nil { 26 | r.Error = awserr.New("SerializationError", "failed decoding Query response", err) 27 | return 28 | } 29 | } 30 | } 31 | 32 | // UnmarshalMeta unmarshals header response values for an AWS Query service. 33 | func UnmarshalMeta(r *request.Request) { 34 | r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import "reflect" 4 | 5 | // PayloadMember returns the payload field member of i if there is one, or nil. 6 | func PayloadMember(i interface{}) interface{} { 7 | if i == nil { 8 | return nil 9 | } 10 | 11 | v := reflect.ValueOf(i).Elem() 12 | if !v.IsValid() { 13 | return nil 14 | } 15 | if field, ok := v.Type().FieldByName("_"); ok { 16 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 17 | field, _ := v.Type().FieldByName(payloadName) 18 | if field.Tag.Get("type") != "structure" { 19 | return nil 20 | } 21 | 22 | payload := v.FieldByName(payloadName) 23 | if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { 24 | return payload.Interface() 25 | } 26 | } 27 | } 28 | return nil 29 | } 30 | 31 | // PayloadType returns the type of a payload field member of i if there is one, or "". 32 | func PayloadType(i interface{}) string { 33 | v := reflect.Indirect(reflect.ValueOf(i)) 34 | if !v.IsValid() { 35 | return "" 36 | } 37 | if field, ok := v.Type().FieldByName("_"); ok { 38 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 39 | if member, ok := v.Type().FieldByName(payloadName); ok { 40 | return member.Tag.Get("type") 41 | } 42 | } 43 | } 44 | return "" 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body 11 | var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} 12 | 13 | // UnmarshalDiscardBody is a request handler to empty a response's body and closing it. 14 | func UnmarshalDiscardBody(r *request.Request) { 15 | if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { 16 | return 17 | } 18 | 19 | io.Copy(ioutil.Discard, r.HTTPResponse.Body) 20 | r.HTTPResponse.Body.Close() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "io/ioutil" 5 | "regexp" 6 | 7 | "github.com/aws/aws-sdk-go/aws" 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/awsutil" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | ) 12 | 13 | var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) 14 | 15 | func buildGetBucketLocation(r *request.Request) { 16 | if r.DataFilled() { 17 | out := r.Data.(*GetBucketLocationOutput) 18 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) 19 | if err != nil { 20 | r.Error = awserr.New("SerializationError", "failed reading response body", err) 21 | return 22 | } 23 | 24 | match := reBucketLocation.FindSubmatch(b) 25 | if len(match) > 1 { 26 | loc := string(match[1]) 27 | out.LocationConstraint = &loc 28 | } 29 | } 30 | } 31 | 32 | func populateLocationConstraint(r *request.Request) { 33 | if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" { 34 | in := r.Params.(*CreateBucketInput) 35 | if in.CreateBucketConfiguration == nil { 36 | r.Params = awsutil.CopyOf(r.Params) 37 | in = r.Params.(*CreateBucketInput) 38 | in.CreateBucketConfiguration = &CreateBucketConfiguration{ 39 | LocationConstraint: r.Config.Region, 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/content_md5.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | "io" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | // contentMD5 computes and sets the HTTP Content-MD5 header for requests that 13 | // require it. 14 | func contentMD5(r *request.Request) { 15 | h := md5.New() 16 | 17 | // hash the body. seek back to the first position after reading to reset 18 | // the body for transmission. copy errors may be assumed to be from the 19 | // body. 20 | _, err := io.Copy(h, r.Body) 21 | if err != nil { 22 | r.Error = awserr.New("ContentMD5", "failed to read body", err) 23 | return 24 | } 25 | _, err = r.Body.Seek(0, 0) 26 | if err != nil { 27 | r.Error = awserr.New("ContentMD5", "failed to seek body", err) 28 | return 29 | } 30 | 31 | // encode the md5 checksum in base64 and set the request header. 32 | sum := h.Sum(nil) 33 | sum64 := make([]byte, base64.StdEncoding.EncodedLen(len(sum))) 34 | base64.StdEncoding.Encode(sum64, sum) 35 | r.HTTPRequest.Header.Set("Content-MD5", string(sum64)) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/client" 5 | "github.com/aws/aws-sdk-go/aws/request" 6 | ) 7 | 8 | func init() { 9 | initClient = defaultInitClientFn 10 | initRequest = defaultInitRequestFn 11 | } 12 | 13 | func defaultInitClientFn(c *client.Client) { 14 | // Support building custom endpoints based on config 15 | c.Handlers.Build.PushFront(updateEndpointForS3Config) 16 | 17 | // Require SSL when using SSE keys 18 | c.Handlers.Validate.PushBack(validateSSERequiresSSL) 19 | c.Handlers.Build.PushBack(computeSSEKeys) 20 | 21 | // S3 uses custom error unmarshaling logic 22 | c.Handlers.UnmarshalError.Clear() 23 | c.Handlers.UnmarshalError.PushBack(unmarshalError) 24 | } 25 | 26 | func defaultInitRequestFn(r *request.Request) { 27 | // Add reuest handlers for specific platforms. 28 | // e.g. 100-continue support for PUT requests using Go 1.6 29 | platformRequestHandlers(r) 30 | 31 | switch r.Operation.Name { 32 | case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, 33 | opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration, 34 | opPutBucketReplication: 35 | // These S3 operations require Content-MD5 to be set 36 | r.Handlers.Build.PushBack(contentMD5) 37 | case opGetBucketLocation: 38 | // GetBucketLocation has custom parsing logic 39 | r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) 40 | case opCreateBucket: 41 | // Auto-populate LocationConstraint with current region 42 | r.Handlers.Validate.PushFront(populateLocationConstraint) 43 | case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: 44 | r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go: -------------------------------------------------------------------------------- 1 | // +build !go1.6 2 | 3 | package s3 4 | 5 | import "github.com/aws/aws-sdk-go/aws/request" 6 | 7 | func platformRequestHandlers(r *request.Request) { 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go: -------------------------------------------------------------------------------- 1 | // +build go1.6 2 | 3 | package s3 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | func platformRequestHandlers(r *request.Request) { 11 | if r.Operation.HTTPMethod == "PUT" { 12 | // 100-Continue should only be used on put requests. 13 | r.Handlers.Sign.PushBack(add100Continue) 14 | } 15 | } 16 | 17 | func add100Continue(r *request.Request) { 18 | if aws.BoolValue(r.Config.S3Disable100Continue) { 19 | return 20 | } 21 | if r.HTTPRequest.ContentLength < 1024*1024*2 { 22 | // Ignore requests smaller than 2MB. This helps prevent delaying 23 | // requests unnecessarily. 24 | return 25 | } 26 | 27 | r.HTTPRequest.Header.Set("Expect", "100-Continue") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/sse.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/awsutil" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil) 13 | 14 | func validateSSERequiresSSL(r *request.Request) { 15 | if r.HTTPRequest.URL.Scheme != "https" { 16 | p, _ := awsutil.ValuesAtPath(r.Params, "SSECustomerKey||CopySourceSSECustomerKey") 17 | if len(p) > 0 { 18 | r.Error = errSSERequiresSSL 19 | } 20 | } 21 | } 22 | 23 | func computeSSEKeys(r *request.Request) { 24 | headers := []string{ 25 | "x-amz-server-side-encryption-customer-key", 26 | "x-amz-copy-source-server-side-encryption-customer-key", 27 | } 28 | 29 | for _, h := range headers { 30 | md5h := h + "-md5" 31 | if key := r.HTTPRequest.Header.Get(h); key != "" { 32 | // Base64-encode the value 33 | b64v := base64.StdEncoding.EncodeToString([]byte(key)) 34 | r.HTTPRequest.Header.Set(h, b64v) 35 | 36 | // Add MD5 if it wasn't computed 37 | if r.HTTPRequest.Header.Get(md5h) == "" { 38 | sum := md5.Sum([]byte(key)) 39 | b64sum := base64.StdEncoding.EncodeToString(sum[:]) 40 | r.HTTPRequest.Header.Set(md5h, b64sum) 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | "github.com/aws/aws-sdk-go/aws" 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | ) 12 | 13 | func copyMultipartStatusOKUnmarhsalError(r *request.Request) { 14 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) 15 | if err != nil { 16 | r.Error = awserr.New("SerializationError", "unable to read response body", err) 17 | return 18 | } 19 | body := bytes.NewReader(b) 20 | r.HTTPResponse.Body = aws.ReadSeekCloser(body) 21 | defer r.HTTPResponse.Body.(aws.ReaderSeekerCloser).Seek(0, 0) 22 | 23 | if body.Len() == 0 { 24 | // If there is no body don't attempt to parse the body. 25 | return 26 | } 27 | 28 | unmarshalError(r) 29 | if err, ok := r.Error.(awserr.Error); ok && err != nil { 30 | if err.Code() == "SerializationError" { 31 | r.Error = nil 32 | return 33 | } 34 | r.HTTPResponse.StatusCode = http.StatusServiceUnavailable 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "encoding/xml" 5 | "fmt" 6 | "io" 7 | "io/ioutil" 8 | "net/http" 9 | "strings" 10 | 11 | "github.com/aws/aws-sdk-go/aws" 12 | "github.com/aws/aws-sdk-go/aws/awserr" 13 | "github.com/aws/aws-sdk-go/aws/request" 14 | ) 15 | 16 | type xmlErrorResponse struct { 17 | XMLName xml.Name `xml:"Error"` 18 | Code string `xml:"Code"` 19 | Message string `xml:"Message"` 20 | } 21 | 22 | func unmarshalError(r *request.Request) { 23 | defer r.HTTPResponse.Body.Close() 24 | defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) 25 | 26 | // Bucket exists in a different region, and request needs 27 | // to be made to the correct region. 28 | if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { 29 | r.Error = awserr.NewRequestFailure( 30 | awserr.New("BucketRegionError", 31 | fmt.Sprintf("incorrect region, the bucket is not in '%s' region", 32 | aws.StringValue(r.Config.Region)), 33 | nil), 34 | r.HTTPResponse.StatusCode, 35 | r.RequestID, 36 | ) 37 | return 38 | } 39 | 40 | var errCode, errMsg string 41 | 42 | // Attempt to parse error from body if it is known 43 | resp := &xmlErrorResponse{} 44 | err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) 45 | if err != nil && err != io.EOF { 46 | errCode = "SerializationError" 47 | errMsg = "failed to decode S3 XML error response" 48 | } else { 49 | errCode = resp.Code 50 | errMsg = resp.Message 51 | } 52 | 53 | // Fallback to status code converted to message if still no error code 54 | if len(errCode) == 0 { 55 | statusText := http.StatusText(r.HTTPResponse.StatusCode) 56 | errCode = strings.Replace(statusText, " ", "", -1) 57 | errMsg = statusText 58 | } 59 | 60 | r.Error = awserr.NewRequestFailure( 61 | awserr.New(errCode, errMsg, nil), 62 | r.HTTPResponse.StatusCode, 63 | r.RequestID, 64 | ) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go: -------------------------------------------------------------------------------- 1 | package sts 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = func(r *request.Request) { 7 | switch r.Operation.Name { 8 | case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: 9 | r.Handlers.Sign.Clear() // these operations are unsigned 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/bgentry/go-netrc/LICENSE: -------------------------------------------------------------------------------- 1 | Original version Copyright © 2010 Fazlul Shahriar . Newer 2 | portions Copyright © 2014 Blake Gentry . 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013 Dave Collins 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/spew/bypasssafe.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Dave Collins 2 | // 3 | // Permission to use, copy, modify, and distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // NOTE: Due to the following build constraints, this file will only be compiled 16 | // when either the code is running on Google App Engine or "-tags disableunsafe" 17 | // is added to the go build command line. 18 | // +build appengine disableunsafe 19 | 20 | package spew 21 | 22 | import "reflect" 23 | 24 | const ( 25 | // UnsafeDisabled is a build-time constant which specifies whether or 26 | // not access to the unsafe package is available. 27 | UnsafeDisabled = true 28 | ) 29 | 30 | // unsafeReflectValue typically converts the passed reflect.Value into a one 31 | // that bypasses the typical safety restrictions preventing access to 32 | // unaddressable and unexported data. However, doing this relies on access to 33 | // the unsafe package. This is a stub version which simply returns the passed 34 | // reflect.Value when the unsafe package is not available. 35 | func unsafeReflectValue(v reflect.Value) reflect.Value { 36 | return v 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "build-{branch}-{build}" 2 | image: Visual Studio 2015 3 | clone_folder: c:\gopath\github.com\hashicorp\go-getter 4 | environment: 5 | GOPATH: c:\gopath 6 | install: 7 | - cmd: >- 8 | echo %Path% 9 | 10 | go version 11 | 12 | go env 13 | 14 | go get -d -v -t ./... 15 | build_script: 16 | - cmd: go test -v ./... 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/client_mode.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // ClientMode is the mode that the client operates in. 4 | type ClientMode uint 5 | 6 | const ( 7 | ClientModeInvalid ClientMode = iota 8 | 9 | // ClientModeAny downloads anything it can. In this mode, dst must 10 | // be a directory. If src is a file, it is saved into the directory 11 | // with the basename of the URL. If src is a directory or archive, 12 | // it is unpacked directly into dst. 13 | ClientModeAny 14 | 15 | // ClientModeFile downloads a single file. In this mode, dst must 16 | // be a file path (doesn't have to exist). src must point to a single 17 | // file. It is saved as dst. 18 | ClientModeFile 19 | 20 | // ClientModeDir downloads a directory. In this mode, dst must be 21 | // a directory path (doesn't have to exist). src must point to an 22 | // archive or directory (such as in s3). 23 | ClientModeDir 24 | ) 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/copy_dir.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "path/filepath" 7 | "strings" 8 | ) 9 | 10 | // copyDir copies the src directory contents into dst. Both directories 11 | // should already exist. 12 | // 13 | // If ignoreDot is set to true, then dot-prefixed files/folders are ignored. 14 | func copyDir(dst string, src string, ignoreDot bool) error { 15 | src, err := filepath.EvalSymlinks(src) 16 | if err != nil { 17 | return err 18 | } 19 | 20 | walkFn := func(path string, info os.FileInfo, err error) error { 21 | if err != nil { 22 | return err 23 | } 24 | if path == src { 25 | return nil 26 | } 27 | 28 | if ignoreDot && strings.HasPrefix(filepath.Base(path), ".") { 29 | // Skip any dot files 30 | if info.IsDir() { 31 | return filepath.SkipDir 32 | } else { 33 | return nil 34 | } 35 | } 36 | 37 | // The "path" has the src prefixed to it. We need to join our 38 | // destination with the path without the src on it. 39 | dstPath := filepath.Join(dst, path[len(src):]) 40 | 41 | // If we have a directory, make that subdirectory, then continue 42 | // the walk. 43 | if info.IsDir() { 44 | if path == filepath.Join(src, dst) { 45 | // dst is in src; don't walk it. 46 | return nil 47 | } 48 | 49 | if err := os.MkdirAll(dstPath, 0755); err != nil { 50 | return err 51 | } 52 | 53 | return nil 54 | } 55 | 56 | // If we have a file, copy the contents. 57 | srcF, err := os.Open(path) 58 | if err != nil { 59 | return err 60 | } 61 | defer srcF.Close() 62 | 63 | dstF, err := os.Create(dstPath) 64 | if err != nil { 65 | return err 66 | } 67 | defer dstF.Close() 68 | 69 | if _, err := io.Copy(dstF, srcF); err != nil { 70 | return err 71 | } 72 | 73 | // Chmod it 74 | return os.Chmod(dstPath, info.Mode()) 75 | } 76 | 77 | return filepath.Walk(src, walkFn) 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // Decompressor defines the interface that must be implemented to add 4 | // support for decompressing a type. 5 | type Decompressor interface { 6 | // Decompress should decompress src to dst. dir specifies whether dst 7 | // is a directory or single file. src is guaranteed to be a single file 8 | // that exists. dst is not guaranteed to exist already. 9 | Decompress(dst, src string, dir bool) error 10 | } 11 | 12 | // Decompressors is the mapping of extension to the Decompressor implementation 13 | // that will decompress that extension/type. 14 | var Decompressors map[string]Decompressor 15 | 16 | func init() { 17 | tbzDecompressor := new(TarBzip2Decompressor) 18 | tgzDecompressor := new(TarGzipDecompressor) 19 | 20 | Decompressors = map[string]Decompressor{ 21 | "bz2": new(Bzip2Decompressor), 22 | "gz": new(GzipDecompressor), 23 | "tar.bz2": tbzDecompressor, 24 | "tar.gz": tgzDecompressor, 25 | "tbz2": tbzDecompressor, 26 | "tgz": tgzDecompressor, 27 | "zip": new(ZipDecompressor), 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress_bzip2.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "compress/bzip2" 5 | "fmt" 6 | "io" 7 | "os" 8 | "path/filepath" 9 | ) 10 | 11 | // Bzip2Decompressor is an implementation of Decompressor that can 12 | // decompress bz2 files. 13 | type Bzip2Decompressor struct{} 14 | 15 | func (d *Bzip2Decompressor) Decompress(dst, src string, dir bool) error { 16 | // Directory isn't supported at all 17 | if dir { 18 | return fmt.Errorf("bzip2-compressed files can only unarchive to a single file") 19 | } 20 | 21 | // If we're going into a directory we should make that first 22 | if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { 23 | return err 24 | } 25 | 26 | // File first 27 | f, err := os.Open(src) 28 | if err != nil { 29 | return err 30 | } 31 | defer f.Close() 32 | 33 | // Bzip2 compression is second 34 | bzipR := bzip2.NewReader(f) 35 | 36 | // Copy it out 37 | dstF, err := os.Create(dst) 38 | if err != nil { 39 | return err 40 | } 41 | defer dstF.Close() 42 | 43 | _, err = io.Copy(dstF, bzipR) 44 | return err 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress_gzip.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "compress/gzip" 5 | "fmt" 6 | "io" 7 | "os" 8 | "path/filepath" 9 | ) 10 | 11 | // GzipDecompressor is an implementation of Decompressor that can 12 | // decompress bz2 files. 13 | type GzipDecompressor struct{} 14 | 15 | func (d *GzipDecompressor) Decompress(dst, src string, dir bool) error { 16 | // Directory isn't supported at all 17 | if dir { 18 | return fmt.Errorf("gzip-compressed files can only unarchive to a single file") 19 | } 20 | 21 | // If we're going into a directory we should make that first 22 | if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { 23 | return err 24 | } 25 | 26 | // File first 27 | f, err := os.Open(src) 28 | if err != nil { 29 | return err 30 | } 31 | defer f.Close() 32 | 33 | // gzip compression is second 34 | gzipR, err := gzip.NewReader(f) 35 | if err != nil { 36 | return err 37 | } 38 | defer gzipR.Close() 39 | 40 | // Copy it out 41 | dstF, err := os.Create(dst) 42 | if err != nil { 43 | return err 44 | } 45 | defer dstF.Close() 46 | 47 | _, err = io.Copy(dstF, gzipR) 48 | return err 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/detect_file.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "runtime" 8 | ) 9 | 10 | // FileDetector implements Detector to detect file paths. 11 | type FileDetector struct{} 12 | 13 | func (d *FileDetector) Detect(src, pwd string) (string, bool, error) { 14 | if len(src) == 0 { 15 | return "", false, nil 16 | } 17 | 18 | if !filepath.IsAbs(src) { 19 | if pwd == "" { 20 | return "", true, fmt.Errorf( 21 | "relative paths require a module with a pwd") 22 | } 23 | 24 | // Stat the pwd to determine if its a symbolic link. If it is, 25 | // then the pwd becomes the original directory. Otherwise, 26 | // `filepath.Join` below does some weird stuff. 27 | // 28 | // We just ignore if the pwd doesn't exist. That error will be 29 | // caught later when we try to use the URL. 30 | if fi, err := os.Lstat(pwd); !os.IsNotExist(err) { 31 | if err != nil { 32 | return "", true, err 33 | } 34 | if fi.Mode()&os.ModeSymlink != 0 { 35 | pwd, err = os.Readlink(pwd) 36 | if err != nil { 37 | return "", true, err 38 | } 39 | 40 | // The symlink itself might be a relative path, so we have to 41 | // resolve this to have a correctly rooted URL. 42 | pwd, err = filepath.Abs(pwd) 43 | if err != nil { 44 | return "", true, err 45 | } 46 | } 47 | } 48 | 49 | src = filepath.Join(pwd, src) 50 | } 51 | 52 | return fmtFileURL(src), true, nil 53 | } 54 | 55 | func fmtFileURL(path string) string { 56 | if runtime.GOOS == "windows" { 57 | // Make sure we're using "/" on Windows. URLs are "/"-based. 58 | path = filepath.ToSlash(path) 59 | return fmt.Sprintf("file://%s", path) 60 | } 61 | 62 | // Make sure that we don't start with "/" since we add that below. 63 | if path[0] == '/' { 64 | path = path[1:] 65 | } 66 | return fmt.Sprintf("file:///%s", path) 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/detect_s3.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "strings" 7 | ) 8 | 9 | // S3Detector implements Detector to detect S3 URLs and turn 10 | // them into URLs that the S3 getter can understand. 11 | type S3Detector struct{} 12 | 13 | func (d *S3Detector) Detect(src, _ string) (string, bool, error) { 14 | if len(src) == 0 { 15 | return "", false, nil 16 | } 17 | 18 | if strings.Contains(src, ".amazonaws.com/") { 19 | return d.detectHTTP(src) 20 | } 21 | 22 | return "", false, nil 23 | } 24 | 25 | func (d *S3Detector) detectHTTP(src string) (string, bool, error) { 26 | parts := strings.Split(src, "/") 27 | if len(parts) < 2 { 28 | return "", false, fmt.Errorf( 29 | "URL is not a valid S3 URL") 30 | } 31 | 32 | hostParts := strings.Split(parts[0], ".") 33 | if len(hostParts) == 3 { 34 | return d.detectPathStyle(hostParts[0], parts[1:]) 35 | } else if len(hostParts) == 4 { 36 | return d.detectVhostStyle(hostParts[1], hostParts[0], parts[1:]) 37 | } else { 38 | return "", false, fmt.Errorf( 39 | "URL is not a valid S3 URL") 40 | } 41 | } 42 | 43 | func (d *S3Detector) detectPathStyle(region string, parts []string) (string, bool, error) { 44 | urlStr := fmt.Sprintf("https://%s.amazonaws.com/%s", region, strings.Join(parts, "/")) 45 | url, err := url.Parse(urlStr) 46 | if err != nil { 47 | return "", false, fmt.Errorf("error parsing S3 URL: %s", err) 48 | } 49 | 50 | return "s3::" + url.String(), true, nil 51 | } 52 | 53 | func (d *S3Detector) detectVhostStyle(region, bucket string, parts []string) (string, bool, error) { 54 | urlStr := fmt.Sprintf("https://%s.amazonaws.com/%s/%s", region, bucket, strings.Join(parts, "/")) 55 | url, err := url.Parse(urlStr) 56 | if err != nil { 57 | return "", false, fmt.Errorf("error parsing S3 URL: %s", err) 58 | } 59 | 60 | return "s3::" + url.String(), true, nil 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/folder_storage.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | "fmt" 7 | "os" 8 | "path/filepath" 9 | ) 10 | 11 | // FolderStorage is an implementation of the Storage interface that manages 12 | // modules on the disk. 13 | type FolderStorage struct { 14 | // StorageDir is the directory where the modules will be stored. 15 | StorageDir string 16 | } 17 | 18 | // Dir implements Storage.Dir 19 | func (s *FolderStorage) Dir(key string) (d string, e bool, err error) { 20 | d = s.dir(key) 21 | _, err = os.Stat(d) 22 | if err == nil { 23 | // Directory exists 24 | e = true 25 | return 26 | } 27 | if os.IsNotExist(err) { 28 | // Directory doesn't exist 29 | d = "" 30 | e = false 31 | err = nil 32 | return 33 | } 34 | 35 | // An error 36 | d = "" 37 | e = false 38 | return 39 | } 40 | 41 | // Get implements Storage.Get 42 | func (s *FolderStorage) Get(key string, source string, update bool) error { 43 | dir := s.dir(key) 44 | if !update { 45 | if _, err := os.Stat(dir); err == nil { 46 | // If the directory already exists, then we're done since 47 | // we're not updating. 48 | return nil 49 | } else if !os.IsNotExist(err) { 50 | // If the error we got wasn't a file-not-exist error, then 51 | // something went wrong and we should report it. 52 | return fmt.Errorf("Error reading module directory: %s", err) 53 | } 54 | } 55 | 56 | // Get the source. This always forces an update. 57 | return Get(dir, source) 58 | } 59 | 60 | // dir returns the directory name internally that we'll use to map to 61 | // internally. 62 | func (s *FolderStorage) dir(key string) string { 63 | sum := md5.Sum([]byte(key)) 64 | return filepath.Join(s.StorageDir, hex.EncodeToString(sum[:])) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/get_file.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // FileGetter is a Getter implementation that will download a module from 4 | // a file scheme. 5 | type FileGetter struct { 6 | // Copy, if set to true, will copy data instead of using a symlink 7 | Copy bool 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/get_mock.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | // MockGetter is an implementation of Getter that can be used for tests. 8 | type MockGetter struct { 9 | // Proxy, if set, will be called after recording the calls below. 10 | // If it isn't set, then the *Err values will be returned. 11 | Proxy Getter 12 | 13 | GetCalled bool 14 | GetDst string 15 | GetURL *url.URL 16 | GetErr error 17 | 18 | GetFileCalled bool 19 | GetFileDst string 20 | GetFileURL *url.URL 21 | GetFileErr error 22 | } 23 | 24 | func (g *MockGetter) Get(dst string, u *url.URL) error { 25 | g.GetCalled = true 26 | g.GetDst = dst 27 | g.GetURL = u 28 | 29 | if g.Proxy != nil { 30 | return g.Proxy.Get(dst, u) 31 | } 32 | 33 | return g.GetErr 34 | } 35 | 36 | func (g *MockGetter) GetFile(dst string, u *url.URL) error { 37 | g.GetFileCalled = true 38 | g.GetFileDst = dst 39 | g.GetFileURL = u 40 | 41 | if g.Proxy != nil { 42 | return g.Proxy.GetFile(dst, u) 43 | } 44 | return g.GetFileErr 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/helper/url/url.go: -------------------------------------------------------------------------------- 1 | package url 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | // Parse parses rawURL into a URL structure. 8 | // The rawURL may be relative or absolute. 9 | // 10 | // Parse is a wrapper for the Go stdlib net/url Parse function, but returns 11 | // Windows "safe" URLs on Windows platforms. 12 | func Parse(rawURL string) (*url.URL, error) { 13 | return parse(rawURL) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/helper/url/url_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package url 4 | 5 | import ( 6 | "net/url" 7 | ) 8 | 9 | func parse(rawURL string) (*url.URL, error) { 10 | return url.Parse(rawURL) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/helper/url/url_windows.go: -------------------------------------------------------------------------------- 1 | package url 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "path/filepath" 7 | "strings" 8 | ) 9 | 10 | func parse(rawURL string) (*url.URL, error) { 11 | // Make sure we're using "/" since URLs are "/"-based. 12 | rawURL = filepath.ToSlash(rawURL) 13 | 14 | u, err := url.Parse(rawURL) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | if len(rawURL) > 1 && rawURL[1] == ':' { 20 | // Assume we're dealing with a drive letter file path where the drive 21 | // letter has been parsed into the URL Scheme, and the rest of the path 22 | // has been parsed into the URL Path without the leading ':' character. 23 | u.Path = fmt.Sprintf("%s:%s", string(rawURL[0]), u.Path) 24 | u.Scheme = "" 25 | } 26 | 27 | if len(u.Host) > 1 && u.Host[1] == ':' && strings.HasPrefix(rawURL, "file://") { 28 | // Assume we're dealing with a drive letter file path where the drive 29 | // letter has been parsed into the URL Host. 30 | u.Path = fmt.Sprintf("%s%s", u.Host, u.Path) 31 | u.Host = "" 32 | } 33 | 34 | // Remove leading slash for absolute file paths. 35 | if len(u.Path) > 2 && u.Path[0] == '/' && u.Path[2] == ':' { 36 | u.Path = u.Path[1:] 37 | } 38 | 39 | return u, err 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/netrc.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "os" 7 | "runtime" 8 | 9 | "github.com/bgentry/go-netrc/netrc" 10 | "github.com/mitchellh/go-homedir" 11 | ) 12 | 13 | // addAuthFromNetrc adds auth information to the URL from the user's 14 | // netrc file if it can be found. This will only add the auth info 15 | // if the URL doesn't already have auth info specified and the 16 | // the username is blank. 17 | func addAuthFromNetrc(u *url.URL) error { 18 | // If the URL already has auth information, do nothing 19 | if u.User != nil && u.User.Username() != "" { 20 | return nil 21 | } 22 | 23 | // Get the netrc file path 24 | path := os.Getenv("NETRC") 25 | if path == "" { 26 | filename := ".netrc" 27 | if runtime.GOOS == "windows" { 28 | filename = "_netrc" 29 | } 30 | 31 | var err error 32 | path, err = homedir.Expand("~/" + filename) 33 | if err != nil { 34 | return err 35 | } 36 | } 37 | 38 | // If the file is not a file, then do nothing 39 | if fi, err := os.Stat(path); err != nil { 40 | // File doesn't exist, do nothing 41 | if os.IsNotExist(err) { 42 | return nil 43 | } 44 | 45 | // Some other error! 46 | return err 47 | } else if fi.IsDir() { 48 | // File is directory, ignore 49 | return nil 50 | } 51 | 52 | // Load up the netrc file 53 | net, err := netrc.ParseFile(path) 54 | if err != nil { 55 | return fmt.Errorf("Error parsing netrc file at %q: %s", path, err) 56 | } 57 | 58 | machine := net.FindMachine(u.Host) 59 | if machine == nil { 60 | // Machine not found, no problem 61 | return nil 62 | } 63 | 64 | // Set the user info 65 | u.User = url.UserPassword(machine.Login, machine.Password) 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/source.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // SourceDirSubdir takes a source and returns a tuple of the URL without 8 | // the subdir and the URL with the subdir. 9 | func SourceDirSubdir(src string) (string, string) { 10 | // Calcaulate an offset to avoid accidentally marking the scheme 11 | // as the dir. 12 | var offset int 13 | if idx := strings.Index(src, "://"); idx > -1 { 14 | offset = idx + 3 15 | } 16 | 17 | // First see if we even have an explicit subdir 18 | idx := strings.Index(src[offset:], "//") 19 | if idx == -1 { 20 | return src, "" 21 | } 22 | 23 | idx += offset 24 | subdir := src[idx+2:] 25 | src = src[:idx] 26 | 27 | // Next, check if we have query parameters and push them onto the 28 | // URL. 29 | if idx = strings.Index(subdir, "?"); idx > -1 { 30 | query := subdir[idx:] 31 | subdir = subdir[:idx] 32 | src += query 33 | } 34 | 35 | return src, subdir 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/storage.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // Storage is an interface that knows how to lookup downloaded directories 4 | // as well as download and update directories from their sources into the 5 | // proper location. 6 | type Storage interface { 7 | // Dir returns the directory on local disk where the directory source 8 | // can be loaded from. 9 | Dir(string) (string, bool, error) 10 | 11 | // Get will download and optionally update the given directory. 12 | Get(string, string, bool) error 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/append.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Append is a helper function that will append more errors 4 | // onto an Error in order to create a larger multi-error. 5 | // 6 | // If err is not a multierror.Error, then it will be turned into 7 | // one. If any of the errs are multierr.Error, they will be flattened 8 | // one level into err. 9 | func Append(err error, errs ...error) *Error { 10 | switch err := err.(type) { 11 | case *Error: 12 | // Typed nils can reach here, so initialize if we are nil 13 | if err == nil { 14 | err = new(Error) 15 | } 16 | 17 | // Go through each error and flatten 18 | for _, e := range errs { 19 | switch e := e.(type) { 20 | case *Error: 21 | err.Errors = append(err.Errors, e.Errors...) 22 | default: 23 | err.Errors = append(err.Errors, e) 24 | } 25 | } 26 | 27 | return err 28 | default: 29 | newErrs := make([]error, 0, len(errs)+1) 30 | if err != nil { 31 | newErrs = append(newErrs, err) 32 | } 33 | newErrs = append(newErrs, errs...) 34 | 35 | return Append(&Error{}, newErrs...) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/flatten.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Flatten flattens the given error, merging any *Errors together into 4 | // a single *Error. 5 | func Flatten(err error) error { 6 | // If it isn't an *Error, just return the error as-is 7 | if _, ok := err.(*Error); !ok { 8 | return err 9 | } 10 | 11 | // Otherwise, make the result and flatten away! 12 | flatErr := new(Error) 13 | flatten(err, flatErr) 14 | return flatErr 15 | } 16 | 17 | func flatten(err error, flatErr *Error) { 18 | switch err := err.(type) { 19 | case *Error: 20 | for _, e := range err.Errors { 21 | flatten(e, flatErr) 22 | } 23 | default: 24 | flatErr.Errors = append(flatErr.Errors, err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/format.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // ErrorFormatFunc is a function callback that is called by Error to 9 | // turn the list of errors into a string. 10 | type ErrorFormatFunc func([]error) string 11 | 12 | // ListFormatFunc is a basic formatter that outputs the number of errors 13 | // that occurred along with a bullet point list of the errors. 14 | func ListFormatFunc(es []error) string { 15 | points := make([]string, len(es)) 16 | for i, err := range es { 17 | points[i] = fmt.Sprintf("* %s", err) 18 | } 19 | 20 | return fmt.Sprintf( 21 | "%d error(s) occurred:\n\n%s", 22 | len(es), strings.Join(points, "\n")) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/multierror.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Error is an error type to track multiple errors. This is used to 8 | // accumulate errors in cases and return them as a single "error". 9 | type Error struct { 10 | Errors []error 11 | ErrorFormat ErrorFormatFunc 12 | } 13 | 14 | func (e *Error) Error() string { 15 | fn := e.ErrorFormat 16 | if fn == nil { 17 | fn = ListFormatFunc 18 | } 19 | 20 | return fn(e.Errors) 21 | } 22 | 23 | // ErrorOrNil returns an error interface if this Error represents 24 | // a list of errors, or returns nil if the list of errors is empty. This 25 | // function is useful at the end of accumulation to make sure that the value 26 | // returned represents the existence of errors. 27 | func (e *Error) ErrorOrNil() error { 28 | if e == nil { 29 | return nil 30 | } 31 | if len(e.Errors) == 0 { 32 | return nil 33 | } 34 | 35 | return e 36 | } 37 | 38 | func (e *Error) GoString() string { 39 | return fmt.Sprintf("*%#v", *e) 40 | } 41 | 42 | // WrappedErrors returns the list of errors that this Error is wrapping. 43 | // It is an implementatin of the errwrap.Wrapper interface so that 44 | // multierror.Error can be used with that library. 45 | // 46 | // This method is not safe to be called concurrently and is no different 47 | // than accessing the Errors field directly. It is implementd only to 48 | // satisfy the errwrap.Wrapper interface. 49 | func (e *Error) WrappedErrors() []error { 50 | return e.Errors 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/prefix.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/errwrap" 7 | ) 8 | 9 | // Prefix is a helper function that will prefix some text 10 | // to the given error. If the error is a multierror.Error, then 11 | // it will be prefixed to each wrapped error. 12 | // 13 | // This is useful to use when appending multiple multierrors 14 | // together in order to give better scoping. 15 | func Prefix(err error, prefix string) error { 16 | if err == nil { 17 | return nil 18 | } 19 | 20 | format := fmt.Sprintf("%s {{err}}", prefix) 21 | switch err := err.(type) { 22 | case *Error: 23 | // Typed nils can reach here, so initialize if we are nil 24 | if err == nil { 25 | err = new(Error) 26 | } 27 | 28 | // Wrap each of the errors 29 | for i, e := range err.Errors { 30 | err.Errors[i] = errwrap.Wrapf(format, e) 31 | } 32 | 33 | return err 34 | default: 35 | return errwrap.Wrapf(format, err) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/discover.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "path/filepath" 5 | ) 6 | 7 | // Discover discovers plugins that are in a given directory. 8 | // 9 | // The directory doesn't need to be absolute. For example, "." will work fine. 10 | // 11 | // This currently assumes any file matching the glob is a plugin. 12 | // In the future this may be smarter about checking that a file is 13 | // executable and so on. 14 | // 15 | // TODO: test 16 | func Discover(glob, dir string) ([]string, error) { 17 | var err error 18 | 19 | // Make the directory absolute if it isn't already 20 | if !filepath.IsAbs(dir) { 21 | dir, err = filepath.Abs(dir) 22 | if err != nil { 23 | return nil, err 24 | } 25 | } 26 | 27 | return filepath.Glob(filepath.Join(dir, glob)) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/error.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | // This is a type that wraps error types so that they can be messaged 4 | // across RPC channels. Since "error" is an interface, we can't always 5 | // gob-encode the underlying structure. This is a valid error interface 6 | // implementer that we will push across. 7 | type BasicError struct { 8 | Message string 9 | } 10 | 11 | // NewBasicError is used to create a BasicError. 12 | // 13 | // err is allowed to be nil. 14 | func NewBasicError(err error) *BasicError { 15 | if err == nil { 16 | return nil 17 | } 18 | 19 | return &BasicError{err.Error()} 20 | } 21 | 22 | func (e *BasicError) Error() string { 23 | return e.Message 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/plugin.go: -------------------------------------------------------------------------------- 1 | // The plugin package exposes functions and helpers for communicating to 2 | // plugins which are implemented as standalone binary applications. 3 | // 4 | // plugin.Client fully manages the lifecycle of executing the application, 5 | // connecting to it, and returning the RPC client for dispensing plugins. 6 | // 7 | // plugin.Serve fully manages listeners to expose an RPC server from a binary 8 | // that plugin.Client can connect to. 9 | package plugin 10 | 11 | import ( 12 | "net/rpc" 13 | ) 14 | 15 | // Plugin is the interface that is implemented to serve/connect to an 16 | // inteface implementation. 17 | type Plugin interface { 18 | // Server should return the RPC server compatible struct to serve 19 | // the methods that the Client calls over net/rpc. 20 | Server(*MuxBroker) (interface{}, error) 21 | 22 | // Client returns an interface implementation for the plugin you're 23 | // serving that communicates to the server end of the plugin. 24 | Client(*MuxBroker, *rpc.Client) (interface{}, error) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/process.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // pidAlive checks whether a pid is alive. 8 | func pidAlive(pid int) bool { 9 | return _pidAlive(pid) 10 | } 11 | 12 | // pidWait blocks for a process to exit. 13 | func pidWait(pid int) error { 14 | ticker := time.NewTicker(1 * time.Second) 15 | defer ticker.Stop() 16 | 17 | for range ticker.C { 18 | if !pidAlive(pid) { 19 | break 20 | } 21 | } 22 | 23 | return nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/process_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package plugin 4 | 5 | import ( 6 | "os" 7 | "syscall" 8 | ) 9 | 10 | // _pidAlive tests whether a process is alive or not by sending it Signal 0, 11 | // since Go otherwise has no way to test this. 12 | func _pidAlive(pid int) bool { 13 | proc, err := os.FindProcess(pid) 14 | if err == nil { 15 | err = proc.Signal(syscall.Signal(0)) 16 | } 17 | 18 | return err == nil 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/process_windows.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | const ( 8 | // Weird name but matches the MSDN docs 9 | exit_STILL_ACTIVE = 259 10 | 11 | processDesiredAccess = syscall.STANDARD_RIGHTS_READ | 12 | syscall.PROCESS_QUERY_INFORMATION | 13 | syscall.SYNCHRONIZE 14 | ) 15 | 16 | // _pidAlive tests whether a process is alive or not 17 | func _pidAlive(pid int) bool { 18 | h, err := syscall.OpenProcess(processDesiredAccess, false, uint32(pid)) 19 | if err != nil { 20 | return false 21 | } 22 | 23 | var ec uint32 24 | if e := syscall.GetExitCodeProcess(h, &ec); e != nil { 25 | return false 26 | } 27 | 28 | return ec == exit_STILL_ACTIVE 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/server_mux.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | // ServeMuxMap is the type that is used to configure ServeMux 9 | type ServeMuxMap map[string]*ServeConfig 10 | 11 | // ServeMux is like Serve, but serves multiple types of plugins determined 12 | // by the argument given on the command-line. 13 | // 14 | // This command doesn't return until the plugin is done being executed. Any 15 | // errors are logged or output to stderr. 16 | func ServeMux(m ServeMuxMap) { 17 | if len(os.Args) != 2 { 18 | fmt.Fprintf(os.Stderr, 19 | "Invoked improperly. This is an internal command that shouldn't\n"+ 20 | "be manually invoked.\n") 21 | os.Exit(1) 22 | } 23 | 24 | opts, ok := m[os.Args[1]] 25 | if !ok { 26 | fmt.Fprintf(os.Stderr, "Unknown plugin: %s\n", os.Args[1]) 27 | os.Exit(1) 28 | } 29 | 30 | Serve(opts) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-plugin/stream.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "io" 5 | "log" 6 | ) 7 | 8 | func copyStream(name string, dst io.Writer, src io.Reader) { 9 | if src == nil { 10 | panic(name + ": src is nil") 11 | } 12 | if dst == nil { 13 | panic(name + ": dst is nil") 14 | } 15 | if _, err := io.Copy(dst, src); err != nil && err != io.EOF { 16 | log.Printf("[ERR] plugin: stream copy '%s' error: %s", name, err) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-uuid/README.md: -------------------------------------------------------------------------------- 1 | # uuid 2 | 3 | Generates UUID-format strings using purely high quality random bytes. 4 | 5 | Documentation 6 | ============= 7 | 8 | The full documentation is available on [Godoc](http://godoc.org/github.com/hashicorp/go-uuid). 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-uuid/uuid.go: -------------------------------------------------------------------------------- 1 | package uuid 2 | 3 | import ( 4 | "crypto/rand" 5 | "encoding/hex" 6 | "fmt" 7 | ) 8 | 9 | // GenerateUUID is used to generate a random UUID 10 | func GenerateUUID() (string, error) { 11 | buf := make([]byte, 16) 12 | if _, err := rand.Read(buf); err != nil { 13 | return "", fmt.Errorf("failed to read random bytes: %v", err) 14 | } 15 | 16 | return FormatUUID(buf) 17 | } 18 | 19 | func FormatUUID(buf []byte) (string, error) { 20 | if len(buf) != 16 { 21 | return "", fmt.Errorf("wrong length byte slice (%d)", len(buf)) 22 | } 23 | 24 | return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x", 25 | buf[0:4], 26 | buf[4:6], 27 | buf[6:8], 28 | buf[8:10], 29 | buf[10:16]), nil 30 | } 31 | 32 | func ParseUUID(uuid string) ([]byte, error) { 33 | if len(uuid) != 36 { 34 | return nil, fmt.Errorf("uuid string is wrong length") 35 | } 36 | 37 | hyph := []byte("-") 38 | 39 | if uuid[8] != hyph[0] || 40 | uuid[13] != hyph[0] || 41 | uuid[18] != hyph[0] || 42 | uuid[23] != hyph[0] { 43 | return nil, fmt.Errorf("uuid is improperly formatted") 44 | } 45 | 46 | hexStr := uuid[0:8] + uuid[9:13] + uuid[14:18] + uuid[19:23] + uuid[24:36] 47 | 48 | ret, err := hex.DecodeString(hexStr) 49 | if err != nil { 50 | return nil, err 51 | } 52 | if len(ret) != 16 { 53 | return nil, fmt.Errorf("decoded hex is the wrong length") 54 | } 55 | 56 | return ret, nil 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-version/version_collection.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | // Collection is a type that implements the sort.Interface interface 4 | // so that versions can be sorted. 5 | type Collection []*Version 6 | 7 | func (v Collection) Len() int { 8 | return len(v) 9 | } 10 | 11 | func (v Collection) Less(i, j int) bool { 12 | return v[i].LessThan(v[j]) 13 | } 14 | 15 | func (v Collection) Swap(i, j int) { 16 | v[i], v[j] = v[j], v[i] 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/Makefile: -------------------------------------------------------------------------------- 1 | TEST?=./... 2 | 3 | default: test 4 | 5 | fmt: generate 6 | go fmt ./... 7 | 8 | test: generate 9 | go get -t ./... 10 | go test $(TEST) $(TESTARGS) 11 | 12 | generate: 13 | go generate ./... 14 | 15 | updatedeps: 16 | go get -u golang.org/x/tools/cmd/stringer 17 | 18 | .PHONY: default generate test updatedeps 19 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "build-{branch}-{build}" 2 | image: Visual Studio 2015 3 | clone_folder: c:\gopath\src\github.com\hashicorp\hcl 4 | environment: 5 | GOPATH: c:\gopath 6 | init: 7 | - git config --global core.autocrlf true 8 | install: 9 | - cmd: >- 10 | echo %Path% 11 | 12 | go version 13 | 14 | go env 15 | 16 | go get -t ./... 17 | 18 | build_script: 19 | - cmd: go test -v ./... 20 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl.go: -------------------------------------------------------------------------------- 1 | // Package hcl decodes HCL into usable Go structures. 2 | // 3 | // hcl input can come in either pure HCL format or JSON format. 4 | // It can be parsed into an AST, and then decoded into a structure, 5 | // or it can be decoded directly from a string into a structure. 6 | // 7 | // If you choose to parse HCL into a raw AST, the benefit is that you 8 | // can write custom visitor implementations to implement custom 9 | // semantic checks. By default, HCL does not perform any semantic 10 | // checks. 11 | package hcl 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/ast/walk.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import "fmt" 4 | 5 | // WalkFunc describes a function to be called for each node during a Walk. The 6 | // returned node can be used to rewrite the AST. Walking stops the returned 7 | // bool is false. 8 | type WalkFunc func(Node) (Node, bool) 9 | 10 | // Walk traverses an AST in depth-first order: It starts by calling fn(node); 11 | // node must not be nil. If fn returns true, Walk invokes fn recursively for 12 | // each of the non-nil children of node, followed by a call of fn(nil). The 13 | // returned node of fn can be used to rewrite the passed node to fn. 14 | func Walk(node Node, fn WalkFunc) Node { 15 | rewritten, ok := fn(node) 16 | if !ok { 17 | return rewritten 18 | } 19 | 20 | switch n := node.(type) { 21 | case *File: 22 | n.Node = Walk(n.Node, fn) 23 | case *ObjectList: 24 | for i, item := range n.Items { 25 | n.Items[i] = Walk(item, fn).(*ObjectItem) 26 | } 27 | case *ObjectKey: 28 | // nothing to do 29 | case *ObjectItem: 30 | for i, k := range n.Keys { 31 | n.Keys[i] = Walk(k, fn).(*ObjectKey) 32 | } 33 | 34 | if n.Val != nil { 35 | n.Val = Walk(n.Val, fn) 36 | } 37 | case *LiteralType: 38 | // nothing to do 39 | case *ListType: 40 | for i, l := range n.List { 41 | n.List[i] = Walk(l, fn) 42 | } 43 | case *ObjectType: 44 | n.List = Walk(n.List, fn).(*ObjectList) 45 | default: 46 | // should we panic here? 47 | fmt.Printf("unknown type: %T\n", n) 48 | } 49 | 50 | fn(nil) 51 | return rewritten 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/parser/error.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hcl/hcl/token" 7 | ) 8 | 9 | // PosError is a parse error that contains a position. 10 | type PosError struct { 11 | Pos token.Pos 12 | Err error 13 | } 14 | 15 | func (e *PosError) Error() string { 16 | return fmt.Sprintf("At %s: %s", e.Pos, e.Err) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/token/position.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import "fmt" 4 | 5 | // Pos describes an arbitrary source position 6 | // including the file, line, and column location. 7 | // A Position is valid if the line number is > 0. 8 | type Pos struct { 9 | Filename string // filename, if any 10 | Offset int // offset, starting at 0 11 | Line int // line number, starting at 1 12 | Column int // column number, starting at 1 (character count) 13 | } 14 | 15 | // IsValid returns true if the position is valid. 16 | func (p *Pos) IsValid() bool { return p.Line > 0 } 17 | 18 | // String returns a string in one of several forms: 19 | // 20 | // file:line:column valid position with file name 21 | // line:column valid position without file name 22 | // file invalid position with file name 23 | // - invalid position without file name 24 | func (p Pos) String() string { 25 | s := p.Filename 26 | if p.IsValid() { 27 | if s != "" { 28 | s += ":" 29 | } 30 | s += fmt.Sprintf("%d:%d", p.Line, p.Column) 31 | } 32 | if s == "" { 33 | s = "-" 34 | } 35 | return s 36 | } 37 | 38 | // Before reports whether the position p is before u. 39 | func (p Pos) Before(u Pos) bool { 40 | return u.Offset > p.Offset || u.Line > p.Line 41 | } 42 | 43 | // After reports whether the position p is after u. 44 | func (p Pos) After(u Pos) bool { 45 | return u.Offset < p.Offset || u.Line < p.Line 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/json/token/position.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import "fmt" 4 | 5 | // Pos describes an arbitrary source position 6 | // including the file, line, and column location. 7 | // A Position is valid if the line number is > 0. 8 | type Pos struct { 9 | Filename string // filename, if any 10 | Offset int // offset, starting at 0 11 | Line int // line number, starting at 1 12 | Column int // column number, starting at 1 (character count) 13 | } 14 | 15 | // IsValid returns true if the position is valid. 16 | func (p *Pos) IsValid() bool { return p.Line > 0 } 17 | 18 | // String returns a string in one of several forms: 19 | // 20 | // file:line:column valid position with file name 21 | // line:column valid position without file name 22 | // file invalid position with file name 23 | // - invalid position without file name 24 | func (p Pos) String() string { 25 | s := p.Filename 26 | if p.IsValid() { 27 | if s != "" { 28 | s += ":" 29 | } 30 | s += fmt.Sprintf("%d:%d", p.Line, p.Column) 31 | } 32 | if s == "" { 33 | s = "-" 34 | } 35 | return s 36 | } 37 | 38 | // Before reports whether the position p is before u. 39 | func (p Pos) Before(u Pos) bool { 40 | return u.Offset > p.Offset || u.Line > p.Line 41 | } 42 | 43 | // After reports whether the position p is after u. 44 | func (p Pos) After(u Pos) bool { 45 | return u.Offset < p.Offset || u.Line < p.Line 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/lex.go: -------------------------------------------------------------------------------- 1 | package hcl 2 | 3 | import ( 4 | "unicode" 5 | "unicode/utf8" 6 | ) 7 | 8 | type lexModeValue byte 9 | 10 | const ( 11 | lexModeUnknown lexModeValue = iota 12 | lexModeHcl 13 | lexModeJson 14 | ) 15 | 16 | // lexMode returns whether we're going to be parsing in JSON 17 | // mode or HCL mode. 18 | func lexMode(v []byte) lexModeValue { 19 | var ( 20 | r rune 21 | w int 22 | offset int 23 | ) 24 | 25 | for { 26 | r, w = utf8.DecodeRune(v[offset:]) 27 | offset += w 28 | if unicode.IsSpace(r) { 29 | continue 30 | } 31 | if r == '{' { 32 | return lexModeJson 33 | } 34 | break 35 | } 36 | 37 | return lexModeHcl 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/parse.go: -------------------------------------------------------------------------------- 1 | package hcl 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hcl/hcl/ast" 7 | hclParser "github.com/hashicorp/hcl/hcl/parser" 8 | jsonParser "github.com/hashicorp/hcl/json/parser" 9 | ) 10 | 11 | // ParseBytes accepts as input byte slice and returns ast tree. 12 | // 13 | // Input can be either JSON or HCL 14 | func ParseBytes(in []byte) (*ast.File, error) { 15 | return parse(in) 16 | } 17 | 18 | // ParseString accepts input as a string and returns ast tree. 19 | func ParseString(input string) (*ast.File, error) { 20 | return parse([]byte(input)) 21 | } 22 | 23 | func parse(in []byte) (*ast.File, error) { 24 | switch lexMode(in) { 25 | case lexModeHcl: 26 | return hclParser.Parse(in) 27 | case lexModeJson: 28 | return jsonParser.Parse(in) 29 | } 30 | 31 | return nil, fmt.Errorf("unknown config format") 32 | } 33 | 34 | // Parse parses the given input and returns the root object. 35 | // 36 | // The input format can be either HCL or JSON. 37 | func Parse(input string) (*ast.File, error) { 38 | return parse([]byte(input)) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "build-{branch}-{build}" 2 | image: Visual Studio 2015 3 | clone_folder: c:\gopath\src\github.com\hashicorp\hil 4 | environment: 5 | GOPATH: c:\gopath 6 | init: 7 | - git config --global core.autocrlf true 8 | install: 9 | - cmd: >- 10 | echo %Path% 11 | 12 | go version 13 | 14 | go env 15 | 16 | go get -d -v -t ./... 17 | build_script: 18 | - cmd: go test -v ./... 19 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/arithmetic.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | // Arithmetic represents a node where the result is arithmetic of 9 | // two or more operands in the order given. 10 | type Arithmetic struct { 11 | Op ArithmeticOp 12 | Exprs []Node 13 | Posx Pos 14 | } 15 | 16 | func (n *Arithmetic) Accept(v Visitor) Node { 17 | for i, expr := range n.Exprs { 18 | n.Exprs[i] = expr.Accept(v) 19 | } 20 | 21 | return v(n) 22 | } 23 | 24 | func (n *Arithmetic) Pos() Pos { 25 | return n.Posx 26 | } 27 | 28 | func (n *Arithmetic) GoString() string { 29 | return fmt.Sprintf("*%#v", *n) 30 | } 31 | 32 | func (n *Arithmetic) String() string { 33 | var b bytes.Buffer 34 | for _, expr := range n.Exprs { 35 | b.WriteString(fmt.Sprintf("%s", expr)) 36 | } 37 | 38 | return b.String() 39 | } 40 | 41 | func (n *Arithmetic) Type(Scope) (Type, error) { 42 | return TypeInt, nil 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/arithmetic_op.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | // ArithmeticOp is the operation to use for the math. 4 | type ArithmeticOp int 5 | 6 | const ( 7 | ArithmeticOpInvalid ArithmeticOp = 0 8 | ArithmeticOpAdd ArithmeticOp = iota 9 | ArithmeticOpSub 10 | ArithmeticOpMul 11 | ArithmeticOpDiv 12 | ArithmeticOpMod 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/call.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // Call represents a function call. 9 | type Call struct { 10 | Func string 11 | Args []Node 12 | Posx Pos 13 | } 14 | 15 | func (n *Call) Accept(v Visitor) Node { 16 | for i, a := range n.Args { 17 | n.Args[i] = a.Accept(v) 18 | } 19 | 20 | return v(n) 21 | } 22 | 23 | func (n *Call) Pos() Pos { 24 | return n.Posx 25 | } 26 | 27 | func (n *Call) String() string { 28 | args := make([]string, len(n.Args)) 29 | for i, arg := range n.Args { 30 | args[i] = fmt.Sprintf("%s", arg) 31 | } 32 | 33 | return fmt.Sprintf("Call(%s, %s)", n.Func, strings.Join(args, ", ")) 34 | } 35 | 36 | func (n *Call) Type(s Scope) (Type, error) { 37 | f, ok := s.LookupFunc(n.Func) 38 | if !ok { 39 | return TypeInvalid, fmt.Errorf("unknown function: %s", n.Func) 40 | } 41 | 42 | return f.ReturnType, nil 43 | } 44 | 45 | func (n *Call) GoString() string { 46 | return fmt.Sprintf("*%#v", *n) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/literal.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // LiteralNode represents a single literal value, such as "foo" or 8 | // 42 or 3.14159. Based on the Type, the Value can be safely cast. 9 | type LiteralNode struct { 10 | Value interface{} 11 | Typex Type 12 | Posx Pos 13 | } 14 | 15 | func (n *LiteralNode) Accept(v Visitor) Node { 16 | return v(n) 17 | } 18 | 19 | func (n *LiteralNode) Pos() Pos { 20 | return n.Posx 21 | } 22 | 23 | func (n *LiteralNode) GoString() string { 24 | return fmt.Sprintf("*%#v", *n) 25 | } 26 | 27 | func (n *LiteralNode) String() string { 28 | return fmt.Sprintf("Literal(%s, %v)", n.Typex, n.Value) 29 | } 30 | 31 | func (n *LiteralNode) Type(Scope) (Type, error) { 32 | return n.Typex, nil 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/stack.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | // Stack is a stack of Node. 4 | type Stack struct { 5 | stack []Node 6 | } 7 | 8 | func (s *Stack) Len() int { 9 | return len(s.stack) 10 | } 11 | 12 | func (s *Stack) Push(n Node) { 13 | s.stack = append(s.stack, n) 14 | } 15 | 16 | func (s *Stack) Pop() Node { 17 | x := s.stack[len(s.stack)-1] 18 | s.stack[len(s.stack)-1] = nil 19 | s.stack = s.stack[:len(s.stack)-1] 20 | return x 21 | } 22 | 23 | func (s *Stack) Reset() { 24 | s.stack = nil 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/type_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=Type"; DO NOT EDIT 2 | 3 | package ast 4 | 5 | import "fmt" 6 | 7 | const ( 8 | _Type_name_0 = "TypeInvalid" 9 | _Type_name_1 = "TypeAny" 10 | _Type_name_2 = "TypeBool" 11 | _Type_name_3 = "TypeString" 12 | _Type_name_4 = "TypeInt" 13 | _Type_name_5 = "TypeFloat" 14 | _Type_name_6 = "TypeList" 15 | _Type_name_7 = "TypeMap" 16 | _Type_name_8 = "TypeUnknown" 17 | ) 18 | 19 | var ( 20 | _Type_index_0 = [...]uint8{0, 11} 21 | _Type_index_1 = [...]uint8{0, 7} 22 | _Type_index_2 = [...]uint8{0, 8} 23 | _Type_index_3 = [...]uint8{0, 10} 24 | _Type_index_4 = [...]uint8{0, 7} 25 | _Type_index_5 = [...]uint8{0, 9} 26 | _Type_index_6 = [...]uint8{0, 8} 27 | _Type_index_7 = [...]uint8{0, 7} 28 | _Type_index_8 = [...]uint8{0, 11} 29 | ) 30 | 31 | func (i Type) String() string { 32 | switch { 33 | case i == 0: 34 | return _Type_name_0 35 | case i == 2: 36 | return _Type_name_1 37 | case i == 4: 38 | return _Type_name_2 39 | case i == 8: 40 | return _Type_name_3 41 | case i == 16: 42 | return _Type_name_4 43 | case i == 32: 44 | return _Type_name_5 45 | case i == 64: 46 | return _Type_name_6 47 | case i == 128: 48 | return _Type_name_7 49 | case i == 256: 50 | return _Type_name_8 51 | default: 52 | return fmt.Sprintf("Type(%d)", i) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/unknown.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | // IsUnknown reports whether a variable is unknown or contains any value 4 | // that is unknown. This will recurse into lists and maps and so on. 5 | func IsUnknown(v Variable) bool { 6 | // If it is unknown itself, return true 7 | if v.Type == TypeUnknown { 8 | return true 9 | } 10 | 11 | // If it is a container type, check the values 12 | switch v.Type { 13 | case TypeList: 14 | for _, el := range v.Value.([]Variable) { 15 | if IsUnknown(el) { 16 | return true 17 | } 18 | } 19 | case TypeMap: 20 | for _, el := range v.Value.(map[string]Variable) { 21 | if IsUnknown(el) { 22 | return true 23 | } 24 | } 25 | default: 26 | } 27 | 28 | // Not a container type or survive the above checks 29 | return false 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/variable_access.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // VariableAccess represents a variable access. 8 | type VariableAccess struct { 9 | Name string 10 | Posx Pos 11 | } 12 | 13 | func (n *VariableAccess) Accept(v Visitor) Node { 14 | return v(n) 15 | } 16 | 17 | func (n *VariableAccess) Pos() Pos { 18 | return n.Posx 19 | } 20 | 21 | func (n *VariableAccess) GoString() string { 22 | return fmt.Sprintf("*%#v", *n) 23 | } 24 | 25 | func (n *VariableAccess) String() string { 26 | return fmt.Sprintf("Variable(%s)", n.Name) 27 | } 28 | 29 | func (n *VariableAccess) Type(s Scope) (Type, error) { 30 | v, ok := s.LookupVar(n.Name) 31 | if !ok { 32 | return TypeInvalid, fmt.Errorf("unknown variable: %s", n.Name) 33 | } 34 | 35 | return v.Type, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/variables_helper.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import "fmt" 4 | 5 | func VariableListElementTypesAreHomogenous(variableName string, list []Variable) (Type, error) { 6 | listTypes := make(map[Type]struct{}) 7 | for _, v := range list { 8 | // Allow unknown 9 | if v.Type == TypeUnknown { 10 | continue 11 | } 12 | 13 | if _, ok := listTypes[v.Type]; ok { 14 | continue 15 | } 16 | listTypes[v.Type] = struct{}{} 17 | } 18 | 19 | if len(listTypes) != 1 && len(list) != 0 { 20 | return TypeInvalid, fmt.Errorf("list %q does not have homogenous types. found %s", variableName, reportTypes(listTypes)) 21 | } 22 | 23 | if len(list) > 0 { 24 | return list[0].Type, nil 25 | } 26 | 27 | return TypeInvalid, fmt.Errorf("list %q does not have any elements so cannot determine type.", variableName) 28 | } 29 | 30 | func VariableMapValueTypesAreHomogenous(variableName string, vmap map[string]Variable) (Type, error) { 31 | valueTypes := make(map[Type]struct{}) 32 | for _, v := range vmap { 33 | // Allow unknown 34 | if v.Type == TypeUnknown { 35 | continue 36 | } 37 | 38 | if _, ok := valueTypes[v.Type]; ok { 39 | continue 40 | } 41 | 42 | valueTypes[v.Type] = struct{}{} 43 | } 44 | 45 | if len(valueTypes) != 1 && len(vmap) != 0 { 46 | return TypeInvalid, fmt.Errorf("map %q does not have homogenous value types. found %s", variableName, reportTypes(valueTypes)) 47 | } 48 | 49 | // For loop here is an easy way to get a single key, we return immediately. 50 | for _, v := range vmap { 51 | return v.Type, nil 52 | } 53 | 54 | // This means the map is empty 55 | return TypeInvalid, fmt.Errorf("map %q does not have any elements so cannot determine type.", variableName) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/eval_type.go: -------------------------------------------------------------------------------- 1 | package hil 2 | 3 | //go:generate stringer -type=EvalType eval_type.go 4 | 5 | // EvalType represents the type of the output returned from a HIL 6 | // evaluation. 7 | type EvalType uint32 8 | 9 | const ( 10 | TypeInvalid EvalType = 0 11 | TypeString EvalType = 1 << iota 12 | TypeBool 13 | TypeList 14 | TypeMap 15 | TypeUnknown 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/evaltype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=EvalType eval_type.go"; DO NOT EDIT 2 | 3 | package hil 4 | 5 | import "fmt" 6 | 7 | const ( 8 | _EvalType_name_0 = "TypeInvalid" 9 | _EvalType_name_1 = "TypeString" 10 | _EvalType_name_2 = "TypeBool" 11 | _EvalType_name_3 = "TypeList" 12 | _EvalType_name_4 = "TypeMap" 13 | _EvalType_name_5 = "TypeUnknown" 14 | ) 15 | 16 | var ( 17 | _EvalType_index_0 = [...]uint8{0, 11} 18 | _EvalType_index_1 = [...]uint8{0, 10} 19 | _EvalType_index_2 = [...]uint8{0, 8} 20 | _EvalType_index_3 = [...]uint8{0, 8} 21 | _EvalType_index_4 = [...]uint8{0, 7} 22 | _EvalType_index_5 = [...]uint8{0, 11} 23 | ) 24 | 25 | func (i EvalType) String() string { 26 | switch { 27 | case i == 0: 28 | return _EvalType_name_0 29 | case i == 2: 30 | return _EvalType_name_1 31 | case i == 4: 32 | return _EvalType_name_2 33 | case i == 8: 34 | return _EvalType_name_3 35 | case i == 16: 36 | return _EvalType_name_4 37 | case i == 32: 38 | return _EvalType_name_5 39 | default: 40 | return fmt.Sprintf("EvalType(%d)", i) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/parse.go: -------------------------------------------------------------------------------- 1 | package hil 2 | 3 | import ( 4 | "github.com/hashicorp/hil/ast" 5 | "github.com/hashicorp/hil/parser" 6 | "github.com/hashicorp/hil/scanner" 7 | ) 8 | 9 | // Parse parses the given program and returns an executable AST tree. 10 | // 11 | // Syntax errors are returned with error having the dynamic type 12 | // *parser.ParseError, which gives the caller access to the source position 13 | // where the error was found, which allows (for example) combining it with 14 | // a known source filename to add context to the error message. 15 | func Parse(v string) (ast.Node, error) { 16 | return ParseWithPosition(v, ast.Pos{Line: 1, Column: 1}) 17 | } 18 | 19 | // ParseWithPosition is like Parse except that it overrides the source 20 | // row and column position of the first character in the string, which should 21 | // be 1-based. 22 | // 23 | // This can be used when HIL is embedded in another language and the outer 24 | // parser knows the row and column where the HIL expression started within 25 | // the overall source file. 26 | func ParseWithPosition(v string, pos ast.Pos) (ast.Node, error) { 27 | ch := scanner.Scan(v, pos) 28 | return parser.Parse(ch) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/parser/binary_op.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "github.com/hashicorp/hil/ast" 5 | "github.com/hashicorp/hil/scanner" 6 | ) 7 | 8 | var binaryOps []map[scanner.TokenType]ast.ArithmeticOp 9 | 10 | func init() { 11 | // This operation table maps from the operator's scanner token type 12 | // to the AST arithmetic operation. All expressions produced from 13 | // binary operators are *ast.Arithmetic nodes. 14 | // 15 | // Binary operator groups are listed in order of precedence, with 16 | // the *lowest* precedence first. Operators within the same group 17 | // have left-to-right associativity. 18 | binaryOps = []map[scanner.TokenType]ast.ArithmeticOp{ 19 | { 20 | scanner.PLUS: ast.ArithmeticOpAdd, 21 | scanner.MINUS: ast.ArithmeticOpSub, 22 | }, 23 | { 24 | scanner.STAR: ast.ArithmeticOpMul, 25 | scanner.SLASH: ast.ArithmeticOpDiv, 26 | scanner.PERCENT: ast.ArithmeticOpMod, 27 | }, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/parser/error.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hil/ast" 7 | "github.com/hashicorp/hil/scanner" 8 | ) 9 | 10 | type ParseError struct { 11 | Message string 12 | Pos ast.Pos 13 | } 14 | 15 | func Errorf(pos ast.Pos, format string, args ...interface{}) error { 16 | return &ParseError{ 17 | Message: fmt.Sprintf(format, args...), 18 | Pos: pos, 19 | } 20 | } 21 | 22 | // TokenErrorf is a convenient wrapper around Errorf that uses the 23 | // position of the given token. 24 | func TokenErrorf(token *scanner.Token, format string, args ...interface{}) error { 25 | return Errorf(token.Pos, format, args...) 26 | } 27 | 28 | func ExpectationError(wanted string, got *scanner.Token) error { 29 | return TokenErrorf(got, "expected %s but found %s", wanted, got) 30 | } 31 | 32 | func (e *ParseError) Error() string { 33 | return fmt.Sprintf("parse error at %s: %s", e.Pos, e.Message) 34 | } 35 | 36 | func (e *ParseError) String() string { 37 | return e.Error() 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/parser/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package parser 4 | 5 | import ( 6 | "github.com/hashicorp/hil/ast" 7 | "github.com/hashicorp/hil/scanner" 8 | ) 9 | 10 | // This is a fuzz testing function designed to be used with go-fuzz: 11 | // https://github.com/dvyukov/go-fuzz 12 | // 13 | // It's not included in a normal build due to the gofuzz build tag above. 14 | // 15 | // There are some input files that you can use as a seed corpus for go-fuzz 16 | // in the directory ./fuzz-corpus . 17 | 18 | func Fuzz(data []byte) int { 19 | str := string(data) 20 | 21 | ch := scanner.Scan(str, ast.Pos{Line: 1, Column: 1}) 22 | _, err := Parse(ch) 23 | if err != nil { 24 | return 0 25 | } 26 | 27 | return 1 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/scanner/peeker.go: -------------------------------------------------------------------------------- 1 | package scanner 2 | 3 | // Peeker is a utility that wraps a token channel returned by Scan and 4 | // provides an interface that allows a caller (e.g. the parser) to 5 | // work with the token stream in a mode that allows one token of lookahead, 6 | // and provides utilities for more convenient processing of the stream. 7 | type Peeker struct { 8 | ch <-chan *Token 9 | peeked *Token 10 | } 11 | 12 | func NewPeeker(ch <-chan *Token) *Peeker { 13 | return &Peeker{ 14 | ch: ch, 15 | } 16 | } 17 | 18 | // Peek returns the next token in the stream without consuming it. A 19 | // subsequent call to Read will return the same token. 20 | func (p *Peeker) Peek() *Token { 21 | if p.peeked == nil { 22 | p.peeked = <-p.ch 23 | } 24 | return p.peeked 25 | } 26 | 27 | // Read consumes the next token in the stream and returns it. 28 | func (p *Peeker) Read() *Token { 29 | token := p.Peek() 30 | 31 | // As a special case, we will produce the EOF token forever once 32 | // it is reached. 33 | if token.Type != EOF { 34 | p.peeked = nil 35 | } 36 | 37 | return token 38 | } 39 | 40 | // Close ensures that the token stream has been exhausted, to prevent 41 | // the goroutine in the underlying scanner from leaking. 42 | // 43 | // It's not necessary to call this if the caller reads the token stream 44 | // to EOF, since that implicitly closes the scanner. 45 | func (p *Peeker) Close() { 46 | for _ = range p.ch { 47 | // discard 48 | } 49 | // Install a synthetic EOF token in 'peeked' in case someone 50 | // erroneously calls Peek() or Read() after we've closed. 51 | p.peeked = &Token{ 52 | Type: EOF, 53 | Content: "", 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/scanner/tokentype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=TokenType"; DO NOT EDIT 2 | 3 | package scanner 4 | 5 | import "fmt" 6 | 7 | const _TokenType_name = "BEGINPERCENTOPARENCPARENSTARPLUSCOMMAMINUSPERIODSLASHBOOLFLOATINTEGERSTRINGOBRACKETCBRACKETIDENTIFIERLITERALENDOQUOTECQUOTEEOFINVALID" 8 | 9 | var _TokenType_map = map[TokenType]string{ 10 | 36: _TokenType_name[0:5], 11 | 37: _TokenType_name[5:12], 12 | 40: _TokenType_name[12:18], 13 | 41: _TokenType_name[18:24], 14 | 42: _TokenType_name[24:28], 15 | 43: _TokenType_name[28:32], 16 | 44: _TokenType_name[32:37], 17 | 45: _TokenType_name[37:42], 18 | 46: _TokenType_name[42:48], 19 | 47: _TokenType_name[48:53], 20 | 66: _TokenType_name[53:57], 21 | 70: _TokenType_name[57:62], 22 | 73: _TokenType_name[62:69], 23 | 83: _TokenType_name[69:75], 24 | 91: _TokenType_name[75:83], 25 | 93: _TokenType_name[83:91], 26 | 105: _TokenType_name[91:101], 27 | 111: _TokenType_name[101:108], 28 | 125: _TokenType_name[108:111], 29 | 8220: _TokenType_name[111:117], 30 | 8221: _TokenType_name[117:123], 31 | 9220: _TokenType_name[123:126], 32 | 65533: _TokenType_name[126:133], 33 | } 34 | 35 | func (i TokenType) String() string { 36 | if str, ok := _TokenType_map[i]; ok { 37 | return str 38 | } 39 | return fmt.Sprintf("TokenType(%d)", i) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/transform_fixed.go: -------------------------------------------------------------------------------- 1 | package hil 2 | 3 | import ( 4 | "github.com/hashicorp/hil/ast" 5 | ) 6 | 7 | // FixedValueTransform transforms an AST to return a fixed value for 8 | // all interpolations. i.e. you can make "hi ${anything}" always 9 | // turn into "hi foo". 10 | // 11 | // The primary use case for this is for config validations where you can 12 | // verify that interpolations result in a certain type of string. 13 | func FixedValueTransform(root ast.Node, Value *ast.LiteralNode) ast.Node { 14 | // We visit the nodes in top-down order 15 | result := root 16 | switch n := result.(type) { 17 | case *ast.Output: 18 | for i, v := range n.Exprs { 19 | n.Exprs[i] = FixedValueTransform(v, Value) 20 | } 21 | case *ast.LiteralNode: 22 | // We keep it as-is 23 | default: 24 | // Anything else we replace 25 | result = Value 26 | } 27 | 28 | return result 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/logutils/README.md: -------------------------------------------------------------------------------- 1 | # logutils 2 | 3 | logutils is a Go package that augments the standard library "log" package 4 | to make logging a bit more modern, without fragmenting the Go ecosystem 5 | with new logging packages. 6 | 7 | ## The simplest thing that could possibly work 8 | 9 | Presumably your application already uses the default `log` package. To switch, you'll want your code to look like the following: 10 | 11 | ```go 12 | package main 13 | 14 | import ( 15 | "log" 16 | "os" 17 | 18 | "github.com/hashicorp/logutils" 19 | ) 20 | 21 | func main() { 22 | filter := &logutils.LevelFilter{ 23 | Levels: []logutils.LogLevel{"DEBUG", "WARN", "ERROR"}, 24 | MinLevel: logutils.LogLevel("WARN"), 25 | Writer: os.Stderr, 26 | } 27 | log.SetOutput(filter) 28 | 29 | log.Print("[DEBUG] Debugging") // this will not print 30 | log.Print("[WARN] Warning") // this will 31 | log.Print("[ERROR] Erring") // and so will this 32 | log.Print("Message I haven't updated") // and so will this 33 | } 34 | ``` 35 | 36 | This logs to standard error exactly like go's standard logger. Any log messages you haven't converted to have a level will continue to print as before. 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/config_tree.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | // configTree represents a tree of configurations where the root is the 4 | // first file and its children are the configurations it has imported. 5 | type configTree struct { 6 | Path string 7 | Config *Config 8 | Children []*configTree 9 | } 10 | 11 | // Flatten flattens the entire tree down to a single merged Config 12 | // structure. 13 | func (t *configTree) Flatten() (*Config, error) { 14 | // No children is easy: we're already merged! 15 | if len(t.Children) == 0 { 16 | return t.Config, nil 17 | } 18 | 19 | // Depth-first, merge all the children first. 20 | childConfigs := make([]*Config, len(t.Children)) 21 | for i, ct := range t.Children { 22 | c, err := ct.Flatten() 23 | if err != nil { 24 | return nil, err 25 | } 26 | 27 | childConfigs[i] = c 28 | } 29 | 30 | // Merge all the children in order 31 | config := childConfigs[0] 32 | childConfigs = childConfigs[1:] 33 | for _, config2 := range childConfigs { 34 | var err error 35 | config, err = Merge(config, config2) 36 | if err != nil { 37 | return nil, err 38 | } 39 | } 40 | 41 | // Merge the final merged child config with our own 42 | return Merge(config, t.Config) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/lang.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "github.com/hashicorp/hil/ast" 5 | ) 6 | 7 | type noopNode struct{} 8 | 9 | func (n *noopNode) Accept(ast.Visitor) ast.Node { return n } 10 | func (n *noopNode) Pos() ast.Pos { return ast.Pos{} } 11 | func (n *noopNode) Type(ast.Scope) (ast.Type, error) { return ast.TypeString, nil } 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/inode.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin openbsd solaris 2 | 3 | package module 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | // lookup the inode of a file on posix systems 12 | func inode(path string) (uint64, error) { 13 | stat, err := os.Stat(path) 14 | if err != nil { 15 | return 0, err 16 | } 17 | if st, ok := stat.Sys().(*syscall.Stat_t); ok { 18 | return st.Ino, nil 19 | } 20 | return 0, fmt.Errorf("could not determine file inode") 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/inode_freebsd.go: -------------------------------------------------------------------------------- 1 | // +build freebsd 2 | 3 | package module 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | // lookup the inode of a file on posix systems 12 | func inode(path string) (uint64, error) { 13 | stat, err := os.Stat(path) 14 | if err != nil { 15 | return 0, err 16 | } 17 | if st, ok := stat.Sys().(*syscall.Stat_t); ok { 18 | return uint64(st.Ino), nil 19 | } 20 | return 0, fmt.Errorf("could not determine file inode") 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/inode_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package module 4 | 5 | // no syscall.Stat_t on windows, return 0 for inodes 6 | func inode(path string) (uint64, error) { 7 | return 0, nil 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/module.go: -------------------------------------------------------------------------------- 1 | package module 2 | 3 | // Module represents the metadata for a single module. 4 | type Module struct { 5 | Name string 6 | Source string 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/tree_gob.go: -------------------------------------------------------------------------------- 1 | package module 2 | 3 | import ( 4 | "bytes" 5 | "encoding/gob" 6 | 7 | "github.com/hashicorp/terraform/config" 8 | ) 9 | 10 | func (t *Tree) GobDecode(bs []byte) error { 11 | t.lock.Lock() 12 | defer t.lock.Unlock() 13 | 14 | // Decode the gob data 15 | var data treeGob 16 | dec := gob.NewDecoder(bytes.NewReader(bs)) 17 | if err := dec.Decode(&data); err != nil { 18 | return err 19 | } 20 | 21 | // Set the fields 22 | t.name = data.Name 23 | t.config = data.Config 24 | t.children = data.Children 25 | t.path = data.Path 26 | 27 | return nil 28 | } 29 | 30 | func (t *Tree) GobEncode() ([]byte, error) { 31 | data := &treeGob{ 32 | Config: t.config, 33 | Children: t.children, 34 | Name: t.name, 35 | Path: t.path, 36 | } 37 | 38 | var buf bytes.Buffer 39 | enc := gob.NewEncoder(&buf) 40 | if err := enc.Encode(data); err != nil { 41 | return nil, err 42 | } 43 | 44 | return buf.Bytes(), nil 45 | } 46 | 47 | // treeGob is used as a structure to Gob encode a tree. 48 | // 49 | // This structure is private so it can't be referenced but the fields are 50 | // public, allowing Gob to properly encode this. When we decode this, we are 51 | // able to turn it into a Tree. 52 | type treeGob struct { 53 | Config *config.Config 54 | Children map[string]*Tree 55 | Name string 56 | Path []string 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/resource_mode.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | //go:generate stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go 4 | type ResourceMode int 5 | 6 | const ( 7 | ManagedResourceMode ResourceMode = iota 8 | DataResourceMode 9 | ) 10 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/resource_mode_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT 2 | 3 | package config 4 | 5 | import "fmt" 6 | 7 | const _ResourceMode_name = "ManagedResourceModeDataResourceMode" 8 | 9 | var _ResourceMode_index = [...]uint8{0, 19, 35} 10 | 11 | func (i ResourceMode) String() string { 12 | if i < 0 || i >= ResourceMode(len(_ResourceMode_index)-1) { 13 | return fmt.Sprintf("ResourceMode(%d)", i) 14 | } 15 | return _ResourceMode_name[_ResourceMode_index[i]:_ResourceMode_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/testing.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | // TestRawConfig is used to create a RawConfig for testing. 8 | func TestRawConfig(t *testing.T, c map[string]interface{}) *RawConfig { 9 | cfg, err := NewRawConfig(c) 10 | if err != nil { 11 | t.Fatalf("err: %s", err) 12 | } 13 | 14 | return cfg 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/dag/edge.go: -------------------------------------------------------------------------------- 1 | package dag 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Edge represents an edge in the graph, with a source and target vertex. 8 | type Edge interface { 9 | Source() Vertex 10 | Target() Vertex 11 | 12 | Hashable 13 | } 14 | 15 | // BasicEdge returns an Edge implementation that simply tracks the source 16 | // and target given as-is. 17 | func BasicEdge(source, target Vertex) Edge { 18 | return &basicEdge{S: source, T: target} 19 | } 20 | 21 | // basicEdge is a basic implementation of Edge that has the source and 22 | // target vertex. 23 | type basicEdge struct { 24 | S, T Vertex 25 | } 26 | 27 | func (e *basicEdge) Hashcode() interface{} { 28 | return fmt.Sprintf("%p-%p", e.S, e.T) 29 | } 30 | 31 | func (e *basicEdge) Source() Vertex { 32 | return e.S 33 | } 34 | 35 | func (e *basicEdge) Target() Vertex { 36 | return e.T 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/flatmap/expand.go: -------------------------------------------------------------------------------- 1 | package flatmap 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "strings" 7 | ) 8 | 9 | // Expand takes a map and a key (prefix) and expands that value into 10 | // a more complex structure. This is the reverse of the Flatten operation. 11 | func Expand(m map[string]string, key string) interface{} { 12 | // If the key is exactly a key in the map, just return it 13 | if v, ok := m[key]; ok { 14 | if v == "true" { 15 | return true 16 | } else if v == "false" { 17 | return false 18 | } 19 | 20 | return v 21 | } 22 | 23 | // Check if the key is an array, and if so, expand the array 24 | if _, ok := m[key+".#"]; ok { 25 | return expandArray(m, key) 26 | } 27 | 28 | // Check if this is a prefix in the map 29 | prefix := key + "." 30 | for k, _ := range m { 31 | if strings.HasPrefix(k, prefix) { 32 | return expandMap(m, prefix) 33 | } 34 | } 35 | 36 | return nil 37 | } 38 | 39 | func expandArray(m map[string]string, prefix string) []interface{} { 40 | num, err := strconv.ParseInt(m[prefix+".#"], 0, 0) 41 | if err != nil { 42 | panic(err) 43 | } 44 | 45 | result := make([]interface{}, num) 46 | for i := 0; i < int(num); i++ { 47 | result[i] = Expand(m, fmt.Sprintf("%s.%d", prefix, i)) 48 | } 49 | 50 | return result 51 | } 52 | 53 | func expandMap(m map[string]string, prefix string) map[string]interface{} { 54 | result := make(map[string]interface{}) 55 | for k, _ := range m { 56 | if !strings.HasPrefix(k, prefix) { 57 | continue 58 | } 59 | 60 | key := k[len(prefix):] 61 | idx := strings.Index(key, ".") 62 | if idx != -1 { 63 | key = key[:idx] 64 | } 65 | if _, ok := result[key]; ok { 66 | continue 67 | } 68 | 69 | // It contains a period, so it is a more complex structure 70 | result[key] = Expand(m, k[:len(prefix)+len(key)]) 71 | } 72 | 73 | return result 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/config/decode.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "github.com/mitchellh/mapstructure" 5 | ) 6 | 7 | func Decode(target interface{}, raws ...interface{}) (*mapstructure.Metadata, error) { 8 | var md mapstructure.Metadata 9 | decoderConfig := &mapstructure.DecoderConfig{ 10 | Metadata: &md, 11 | Result: target, 12 | WeaklyTypedInput: true, 13 | } 14 | 15 | decoder, err := mapstructure.NewDecoder(decoderConfig) 16 | if err != nil { 17 | return nil, err 18 | } 19 | 20 | for _, raw := range raws { 21 | err := decoder.Decode(raw) 22 | if err != nil { 23 | return nil, err 24 | } 25 | } 26 | 27 | return &md, nil 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/experiment/id.go: -------------------------------------------------------------------------------- 1 | package experiment 2 | 3 | // ID represents an experimental feature. 4 | // 5 | // The global vars defined on this package should be used as ID values. 6 | // This interface is purposely not implement-able outside of this package 7 | // so that we can rely on the Go compiler to enforce all experiment references. 8 | type ID interface { 9 | Env() string 10 | Flag() string 11 | Default() bool 12 | 13 | unexported() // So the ID can't be implemented externally. 14 | } 15 | 16 | // basicID implements ID. 17 | type basicID struct { 18 | EnvValue string 19 | FlagValue string 20 | DefaultValue bool 21 | } 22 | 23 | func newBasicID(flag, env string, def bool) ID { 24 | return &basicID{ 25 | EnvValue: env, 26 | FlagValue: flag, 27 | DefaultValue: def, 28 | } 29 | } 30 | 31 | func (id *basicID) Env() string { return id.EnvValue } 32 | func (id *basicID) Flag() string { return id.FlagValue } 33 | func (id *basicID) Default() bool { return id.DefaultValue } 34 | func (id *basicID) unexported() {} 35 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go: -------------------------------------------------------------------------------- 1 | package hashcode 2 | 3 | import ( 4 | "hash/crc32" 5 | ) 6 | 7 | // String hashes a string to a unique hashcode. 8 | // 9 | // crc32 returns a uint32, but for our use we need 10 | // and non negative integer. Here we cast to an integer 11 | // and invert it if the result is negative. 12 | func String(s string) int { 13 | v := int(crc32.ChecksumIEEE([]byte(s))) 14 | if v >= 0 { 15 | return v 16 | } 17 | if -v >= 0 { 18 | return -v 19 | } 20 | // v == MinInt 21 | return 0 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/hilmapstructure/hilmapstructure.go: -------------------------------------------------------------------------------- 1 | package hilmapstructure 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/mitchellh/mapstructure" 8 | ) 9 | 10 | var hilMapstructureDecodeHookEmptySlice []interface{} 11 | var hilMapstructureDecodeHookStringSlice []string 12 | var hilMapstructureDecodeHookEmptyMap map[string]interface{} 13 | 14 | // WeakDecode behaves in the same way as mapstructure.WeakDecode but has a 15 | // DecodeHook which defeats the backward compatibility mode of mapstructure 16 | // which WeakDecodes []interface{}{} into an empty map[string]interface{}. This 17 | // allows us to use WeakDecode (desirable), but not fail on empty lists. 18 | func WeakDecode(m interface{}, rawVal interface{}) error { 19 | config := &mapstructure.DecoderConfig{ 20 | DecodeHook: func(source reflect.Type, target reflect.Type, val interface{}) (interface{}, error) { 21 | sliceType := reflect.TypeOf(hilMapstructureDecodeHookEmptySlice) 22 | stringSliceType := reflect.TypeOf(hilMapstructureDecodeHookStringSlice) 23 | mapType := reflect.TypeOf(hilMapstructureDecodeHookEmptyMap) 24 | 25 | if (source == sliceType || source == stringSliceType) && target == mapType { 26 | return nil, fmt.Errorf("Cannot convert a []interface{} into a map[string]interface{}") 27 | } 28 | 29 | return val, nil 30 | }, 31 | WeaklyTypedInput: true, 32 | Result: rawVal, 33 | } 34 | 35 | decoder, err := mapstructure.NewDecoder(config) 36 | if err != nil { 37 | return err 38 | } 39 | 40 | return decoder.Decode(m) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/resource/id.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | "math/big" 7 | "sync" 8 | ) 9 | 10 | const UniqueIdPrefix = `terraform-` 11 | 12 | // idCounter is a randomly seeded monotonic counter for generating ordered 13 | // unique ids. It uses a big.Int so we can easily increment a long numeric 14 | // string. The max possible hex value here with 12 random bytes is 15 | // "01000000000000000000000000", so there's no chance of rollover during 16 | // operation. 17 | var idMutex sync.Mutex 18 | var idCounter = big.NewInt(0).SetBytes(randomBytes(12)) 19 | 20 | // Helper for a resource to generate a unique identifier w/ default prefix 21 | func UniqueId() string { 22 | return PrefixedUniqueId(UniqueIdPrefix) 23 | } 24 | 25 | // Helper for a resource to generate a unique identifier w/ given prefix 26 | // 27 | // After the prefix, the ID consists of an incrementing 26 digit value (to match 28 | // previous timestamp output). 29 | func PrefixedUniqueId(prefix string) string { 30 | idMutex.Lock() 31 | defer idMutex.Unlock() 32 | return fmt.Sprintf("%s%026x", prefix, idCounter.Add(idCounter, big.NewInt(1))) 33 | } 34 | 35 | func randomBytes(n int) []byte { 36 | b := make([]byte, n) 37 | rand.Read(b) 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/resource/resource.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/helper/config" 5 | "github.com/hashicorp/terraform/terraform" 6 | ) 7 | 8 | type Resource struct { 9 | ConfigValidator *config.Validator 10 | Create CreateFunc 11 | Destroy DestroyFunc 12 | Diff DiffFunc 13 | Refresh RefreshFunc 14 | Update UpdateFunc 15 | } 16 | 17 | // CreateFunc is a function that creates a resource that didn't previously 18 | // exist. 19 | type CreateFunc func( 20 | *terraform.InstanceState, 21 | *terraform.InstanceDiff, 22 | interface{}) (*terraform.InstanceState, error) 23 | 24 | // DestroyFunc is a function that destroys a resource that previously 25 | // exists using the state. 26 | type DestroyFunc func( 27 | *terraform.InstanceState, 28 | interface{}) error 29 | 30 | // DiffFunc is a function that performs a diff of a resource. 31 | type DiffFunc func( 32 | *terraform.InstanceState, 33 | *terraform.ResourceConfig, 34 | interface{}) (*terraform.InstanceDiff, error) 35 | 36 | // RefreshFunc is a function that performs a refresh of a specific type 37 | // of resource. 38 | type RefreshFunc func( 39 | *terraform.InstanceState, 40 | interface{}) (*terraform.InstanceState, error) 41 | 42 | // UpdateFunc is a function that is called to update a resource that 43 | // previously existed. The difference between this and CreateFunc is that 44 | // the diff is guaranteed to only contain attributes that don't require 45 | // a new resource. 46 | type UpdateFunc func( 47 | *terraform.InstanceState, 48 | *terraform.InstanceDiff, 49 | interface{}) (*terraform.InstanceState, error) 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/README.md: -------------------------------------------------------------------------------- 1 | # Terraform Helper Lib: schema 2 | 3 | The `schema` package provides a high-level interface for writing resource 4 | providers for Terraform. 5 | 6 | If you're writing a resource provider, we recommend you use this package. 7 | 8 | The interface exposed by this package is much friendlier than trying to 9 | write to the Terraform API directly. The core Terraform API is low-level 10 | and built for maximum flexibility and control, whereas this library is built 11 | as a framework around that to more easily write common providers. 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/equal.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | // Equal is an interface that checks for deep equality between two objects. 4 | type Equal interface { 5 | Equal(interface{}) bool 6 | } 7 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/field_reader_multi.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // MultiLevelFieldReader reads from other field readers, 8 | // merging their results along the way in a specific order. You can specify 9 | // "levels" and name them in order to read only an exact level or up to 10 | // a specific level. 11 | // 12 | // This is useful for saying things such as "read the field from the state 13 | // and config and merge them" or "read the latest value of the field". 14 | type MultiLevelFieldReader struct { 15 | Readers map[string]FieldReader 16 | Levels []string 17 | } 18 | 19 | func (r *MultiLevelFieldReader) ReadField(address []string) (FieldReadResult, error) { 20 | return r.ReadFieldMerge(address, r.Levels[len(r.Levels)-1]) 21 | } 22 | 23 | func (r *MultiLevelFieldReader) ReadFieldExact( 24 | address []string, level string) (FieldReadResult, error) { 25 | reader, ok := r.Readers[level] 26 | if !ok { 27 | return FieldReadResult{}, fmt.Errorf( 28 | "Unknown reader level: %s", level) 29 | } 30 | 31 | result, err := reader.ReadField(address) 32 | if err != nil { 33 | return FieldReadResult{}, fmt.Errorf( 34 | "Error reading level %s: %s", level, err) 35 | } 36 | 37 | return result, nil 38 | } 39 | 40 | func (r *MultiLevelFieldReader) ReadFieldMerge( 41 | address []string, level string) (FieldReadResult, error) { 42 | var result FieldReadResult 43 | for _, l := range r.Levels { 44 | if r, ok := r.Readers[l]; ok { 45 | out, err := r.ReadField(address) 46 | if err != nil { 47 | return FieldReadResult{}, fmt.Errorf( 48 | "Error reading level %s: %s", l, err) 49 | } 50 | 51 | // TODO: computed 52 | if out.Exists { 53 | result = out 54 | } 55 | } 56 | 57 | if l == level { 58 | break 59 | } 60 | } 61 | 62 | return result, nil 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/field_writer.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | // FieldWriters are responsible for writing fields by address into 4 | // a proper typed representation. ResourceData uses this to write new data 5 | // into existing sources. 6 | type FieldWriter interface { 7 | WriteField([]string, interface{}) error 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/getsource_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=getSource resource_data_get_source.go"; DO NOT EDIT 2 | 3 | package schema 4 | 5 | import "fmt" 6 | 7 | const ( 8 | _getSource_name_0 = "getSourceStategetSourceConfig" 9 | _getSource_name_1 = "getSourceDiff" 10 | _getSource_name_2 = "getSourceSet" 11 | _getSource_name_3 = "getSourceLevelMaskgetSourceExact" 12 | ) 13 | 14 | var ( 15 | _getSource_index_0 = [...]uint8{0, 14, 29} 16 | _getSource_index_1 = [...]uint8{0, 13} 17 | _getSource_index_2 = [...]uint8{0, 12} 18 | _getSource_index_3 = [...]uint8{0, 18, 32} 19 | ) 20 | 21 | func (i getSource) String() string { 22 | switch { 23 | case 1 <= i && i <= 2: 24 | i -= 1 25 | return _getSource_name_0[_getSource_index_0[i]:_getSource_index_0[i+1]] 26 | case i == 4: 27 | return _getSource_name_1 28 | case i == 8: 29 | return _getSource_name_2 30 | case 15 <= i && i <= 16: 31 | i -= 15 32 | return _getSource_name_3[_getSource_index_3[i]:_getSource_index_3[i+1]] 33 | default: 34 | return fmt.Sprintf("getSource(%d)", i) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/resource_data_get_source.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | //go:generate stringer -type=getSource resource_data_get_source.go 4 | 5 | // getSource represents the level we want to get for a value (internally). 6 | // Any source less than or equal to the level will be loaded (whichever 7 | // has a value first). 8 | type getSource byte 9 | 10 | const ( 11 | getSourceState getSource = 1 << iota 12 | getSourceConfig 13 | getSourceDiff 14 | getSourceSet 15 | getSourceExact // Only get from the _exact_ level 16 | getSourceLevelMask getSource = getSourceState | getSourceConfig | getSourceDiff | getSourceSet 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/valuetype.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | //go:generate stringer -type=ValueType valuetype.go 4 | 5 | // ValueType is an enum of the type that can be represented by a schema. 6 | type ValueType int 7 | 8 | const ( 9 | TypeInvalid ValueType = iota 10 | TypeBool 11 | TypeInt 12 | TypeFloat 13 | TypeString 14 | TypeList 15 | TypeMap 16 | TypeSet 17 | typeObject 18 | ) 19 | 20 | // NOTE: ValueType has more functions defined on it in schema.go. We can't 21 | // put them here because we reference other files. 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/schema/valuetype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=ValueType valuetype.go"; DO NOT EDIT 2 | 3 | package schema 4 | 5 | import "fmt" 6 | 7 | const _ValueType_name = "TypeInvalidTypeBoolTypeIntTypeFloatTypeStringTypeListTypeMapTypeSettypeObject" 8 | 9 | var _ValueType_index = [...]uint8{0, 11, 19, 26, 35, 45, 53, 60, 67, 77} 10 | 11 | func (i ValueType) String() string { 12 | if i < 0 || i >= ValueType(len(_ValueType_index)-1) { 13 | return fmt.Sprintf("ValueType(%d)", i) 14 | } 15 | return _ValueType_name[_ValueType_index[i]:_ValueType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/shadow/ordered_value.go: -------------------------------------------------------------------------------- 1 | package shadow 2 | 3 | import ( 4 | "container/list" 5 | "sync" 6 | ) 7 | 8 | // OrderedValue is a struct that keeps track of a value in the order 9 | // it is set. Each time Value() is called, it will return the most recent 10 | // calls value then discard it. 11 | // 12 | // This is unlike Value that returns the same value once it is set. 13 | type OrderedValue struct { 14 | lock sync.Mutex 15 | values *list.List 16 | waiters *list.List 17 | } 18 | 19 | // Value returns the last value that was set, or blocks until one 20 | // is received. 21 | func (w *OrderedValue) Value() interface{} { 22 | w.lock.Lock() 23 | 24 | // If we have a pending value already, use it 25 | if w.values != nil && w.values.Len() > 0 { 26 | front := w.values.Front() 27 | w.values.Remove(front) 28 | w.lock.Unlock() 29 | return front.Value 30 | } 31 | 32 | // No pending value, create a waiter 33 | if w.waiters == nil { 34 | w.waiters = list.New() 35 | } 36 | 37 | var val Value 38 | w.waiters.PushBack(&val) 39 | w.lock.Unlock() 40 | 41 | // Return the value once we have it 42 | return val.Value() 43 | } 44 | 45 | // SetValue sets the latest value. 46 | func (w *OrderedValue) SetValue(v interface{}) { 47 | w.lock.Lock() 48 | defer w.lock.Unlock() 49 | 50 | // If we have a waiter, notify it 51 | if w.waiters != nil && w.waiters.Len() > 0 { 52 | front := w.waiters.Front() 53 | w.waiters.Remove(front) 54 | 55 | val := front.Value.(*Value) 56 | val.SetValue(v) 57 | return 58 | } 59 | 60 | // Add it to the list of values 61 | if w.values == nil { 62 | w.values = list.New() 63 | } 64 | 65 | w.values.PushBack(v) 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/plugin/plugin.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "github.com/hashicorp/go-plugin" 5 | ) 6 | 7 | // See serve.go for serving plugins 8 | 9 | // PluginMap should be used by clients for the map of plugins. 10 | var PluginMap = map[string]plugin.Plugin{ 11 | "provider": &ResourceProviderPlugin{}, 12 | "provisioner": &ResourceProvisionerPlugin{}, 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/plugin/ui_input.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "net/rpc" 5 | 6 | "github.com/hashicorp/go-plugin" 7 | "github.com/hashicorp/terraform/terraform" 8 | ) 9 | 10 | // UIInput is an implementatin of terraform.UIInput that communicates 11 | // over RPC. 12 | type UIInput struct { 13 | Client *rpc.Client 14 | } 15 | 16 | func (i *UIInput) Input(opts *terraform.InputOpts) (string, error) { 17 | var resp UIInputInputResponse 18 | err := i.Client.Call("Plugin.Input", opts, &resp) 19 | if err != nil { 20 | return "", err 21 | } 22 | if resp.Error != nil { 23 | err = resp.Error 24 | return "", err 25 | } 26 | 27 | return resp.Value, nil 28 | } 29 | 30 | type UIInputInputResponse struct { 31 | Value string 32 | Error *plugin.BasicError 33 | } 34 | 35 | // UIInputServer is a net/rpc compatible structure for serving 36 | // a UIInputServer. This should not be used directly. 37 | type UIInputServer struct { 38 | UIInput terraform.UIInput 39 | } 40 | 41 | func (s *UIInputServer) Input( 42 | opts *terraform.InputOpts, 43 | reply *UIInputInputResponse) error { 44 | value, err := s.UIInput.Input(opts) 45 | *reply = UIInputInputResponse{ 46 | Value: value, 47 | Error: plugin.NewBasicError(err), 48 | } 49 | 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/plugin/ui_output.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "net/rpc" 5 | 6 | "github.com/hashicorp/terraform/terraform" 7 | ) 8 | 9 | // UIOutput is an implementatin of terraform.UIOutput that communicates 10 | // over RPC. 11 | type UIOutput struct { 12 | Client *rpc.Client 13 | } 14 | 15 | func (o *UIOutput) Output(v string) { 16 | o.Client.Call("Plugin.Output", v, new(interface{})) 17 | } 18 | 19 | // UIOutputServer is the RPC server for serving UIOutput. 20 | type UIOutputServer struct { 21 | UIOutput terraform.UIOutput 22 | } 23 | 24 | func (s *UIOutputServer) Output( 25 | v string, 26 | reply *interface{}) error { 27 | s.UIOutput.Output(v) 28 | return nil 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/edge_destroy.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // DestroyEdge is an edge that represents a standard "destroy" relationship: 10 | // Target depends on Source because Source is destroying. 11 | type DestroyEdge struct { 12 | S, T dag.Vertex 13 | } 14 | 15 | func (e *DestroyEdge) Hashcode() interface{} { return fmt.Sprintf("%p-%p", e.S, e.T) } 16 | func (e *DestroyEdge) Source() dag.Vertex { return e.S } 17 | func (e *DestroyEdge) Target() dag.Vertex { return e.T } 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_check_prevent_destroy.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/config" 7 | ) 8 | 9 | // EvalPreventDestroy is an EvalNode implementation that returns an 10 | // error if a resource has PreventDestroy configured and the diff 11 | // would destroy the resource. 12 | type EvalCheckPreventDestroy struct { 13 | Resource *config.Resource 14 | ResourceId string 15 | Diff **InstanceDiff 16 | } 17 | 18 | func (n *EvalCheckPreventDestroy) Eval(ctx EvalContext) (interface{}, error) { 19 | if n.Diff == nil || *n.Diff == nil || n.Resource == nil { 20 | return nil, nil 21 | } 22 | 23 | diff := *n.Diff 24 | preventDestroy := n.Resource.Lifecycle.PreventDestroy 25 | 26 | if diff.GetDestroy() && preventDestroy { 27 | resourceId := n.ResourceId 28 | if resourceId == "" { 29 | resourceId = n.Resource.Id() 30 | } 31 | 32 | return nil, fmt.Errorf(preventDestroyErrStr, resourceId) 33 | } 34 | 35 | return nil, nil 36 | } 37 | 38 | const preventDestroyErrStr = `%s: the plan would destroy this resource, but it currently has lifecycle.prevent_destroy set to true. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or adjust the scope of the plan using the -target flag.` 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_count.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/config" 5 | ) 6 | 7 | // EvalCountFixZeroOneBoundary is an EvalNode that fixes up the state 8 | // when there is a resource count with zero/one boundary, i.e. fixing 9 | // a resource named "aws_instance.foo" to "aws_instance.foo.0" and vice-versa. 10 | type EvalCountFixZeroOneBoundary struct { 11 | Resource *config.Resource 12 | } 13 | 14 | // TODO: test 15 | func (n *EvalCountFixZeroOneBoundary) Eval(ctx EvalContext) (interface{}, error) { 16 | // Get the count, important for knowing whether we're supposed to 17 | // be adding the zero, or trimming it. 18 | count, err := n.Resource.Count() 19 | if err != nil { 20 | return nil, err 21 | } 22 | 23 | // Figure what to look for and what to replace it with 24 | hunt := n.Resource.Id() 25 | replace := hunt + ".0" 26 | if count < 2 { 27 | hunt, replace = replace, hunt 28 | } 29 | 30 | state, lock := ctx.State() 31 | 32 | // Get a lock so we can access this instance and potentially make 33 | // changes to it. 34 | lock.Lock() 35 | defer lock.Unlock() 36 | 37 | // Look for the module state. If we don't have one, then it doesn't matter. 38 | mod := state.ModuleByPath(ctx.Path()) 39 | if mod == nil { 40 | return nil, nil 41 | } 42 | 43 | // Look for the resource state. If we don't have one, then it is okay. 44 | rs, ok := mod.Resources[hunt] 45 | if !ok { 46 | return nil, nil 47 | } 48 | 49 | // If the replacement key exists, we just keep both 50 | if _, ok := mod.Resources[replace]; ok { 51 | return nil, nil 52 | } 53 | 54 | mod.Resources[replace] = rs 55 | delete(mod.Resources, hunt) 56 | 57 | return nil, nil 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_count_computed.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/config" 7 | ) 8 | 9 | // EvalCountCheckComputed is an EvalNode that checks if a resource count 10 | // is computed and errors if so. This can possibly happen across a 11 | // module boundary and we don't yet support this. 12 | type EvalCountCheckComputed struct { 13 | Resource *config.Resource 14 | } 15 | 16 | // TODO: test 17 | func (n *EvalCountCheckComputed) Eval(ctx EvalContext) (interface{}, error) { 18 | if n.Resource.RawCount.Value() == unknownValue() { 19 | return nil, fmt.Errorf( 20 | "%s: value of 'count' cannot be computed", 21 | n.Resource.Id()) 22 | } 23 | 24 | return nil, nil 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_error.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalReturnError is an EvalNode implementation that returns an 4 | // error if it is present. 5 | // 6 | // This is useful for scenarios where an error has been captured by 7 | // another EvalNode (like EvalApply) for special EvalTree-based error 8 | // handling, and that handling has completed, so the error should be 9 | // returned normally. 10 | type EvalReturnError struct { 11 | Error *error 12 | } 13 | 14 | func (n *EvalReturnError) Eval(ctx EvalContext) (interface{}, error) { 15 | if n.Error == nil { 16 | return nil, nil 17 | } 18 | 19 | return nil, *n.Error 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_filter.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalNodeFilterFunc is the callback used to replace a node with 4 | // another to node. To not do the replacement, just return the input node. 5 | type EvalNodeFilterFunc func(EvalNode) EvalNode 6 | 7 | // EvalNodeFilterable is an interface that can be implemented by 8 | // EvalNodes to allow filtering of sub-elements. Note that this isn't 9 | // a common thing to implement and you probably don't need it. 10 | type EvalNodeFilterable interface { 11 | EvalNode 12 | Filter(EvalNodeFilterFunc) 13 | } 14 | 15 | // EvalFilter runs the filter on the given node and returns the 16 | // final filtered value. This should be called rather than checking 17 | // the EvalNode directly since this will properly handle EvalNodeFilterables. 18 | func EvalFilter(node EvalNode, fn EvalNodeFilterFunc) EvalNode { 19 | if f, ok := node.(EvalNodeFilterable); ok { 20 | f.Filter(fn) 21 | return node 22 | } 23 | 24 | return fn(node) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_filter_operation.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalNodeOpFilterable is an interface that EvalNodes can implement 4 | // to be filterable by the operation that is being run on Terraform. 5 | type EvalNodeOpFilterable interface { 6 | IncludeInOp(walkOperation) bool 7 | } 8 | 9 | // EvalNodeFilterOp returns a filter function that filters nodes that 10 | // include themselves in specific operations. 11 | func EvalNodeFilterOp(op walkOperation) EvalNodeFilterFunc { 12 | return func(n EvalNode) EvalNode { 13 | include := true 14 | if of, ok := n.(EvalNodeOpFilterable); ok { 15 | include = of.IncludeInOp(op) 16 | } 17 | if include { 18 | return n 19 | } 20 | 21 | return EvalNoop{} 22 | } 23 | } 24 | 25 | // EvalOpFilter is an EvalNode implementation that is a proxy to 26 | // another node but filters based on the operation. 27 | type EvalOpFilter struct { 28 | // Ops is the list of operations to include this node in. 29 | Ops []walkOperation 30 | 31 | // Node is the node to execute 32 | Node EvalNode 33 | } 34 | 35 | // TODO: test 36 | func (n *EvalOpFilter) Eval(ctx EvalContext) (interface{}, error) { 37 | return EvalRaw(n.Node, ctx) 38 | } 39 | 40 | // EvalNodeOpFilterable impl. 41 | func (n *EvalOpFilter) IncludeInOp(op walkOperation) bool { 42 | for _, v := range n.Ops { 43 | if v == op { 44 | return true 45 | } 46 | } 47 | 48 | return false 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_if.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalIf is an EvalNode that is a conditional. 4 | type EvalIf struct { 5 | If func(EvalContext) (bool, error) 6 | Then EvalNode 7 | Else EvalNode 8 | } 9 | 10 | // TODO: test 11 | func (n *EvalIf) Eval(ctx EvalContext) (interface{}, error) { 12 | yes, err := n.If(ctx) 13 | if err != nil { 14 | return nil, err 15 | } 16 | 17 | if yes { 18 | return EvalRaw(n.Then, ctx) 19 | } else { 20 | if n.Else != nil { 21 | return EvalRaw(n.Else, ctx) 22 | } 23 | } 24 | 25 | return nil, nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import "github.com/hashicorp/terraform/config" 4 | 5 | // EvalInterpolate is an EvalNode implementation that takes a raw 6 | // configuration and interpolates it. 7 | type EvalInterpolate struct { 8 | Config *config.RawConfig 9 | Resource *Resource 10 | Output **ResourceConfig 11 | } 12 | 13 | func (n *EvalInterpolate) Eval(ctx EvalContext) (interface{}, error) { 14 | rc, err := ctx.Interpolate(n.Config, n.Resource) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | if n.Output != nil { 20 | *n.Output = rc 21 | } 22 | 23 | return nil, nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_noop.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalNoop is an EvalNode that does nothing. 4 | type EvalNoop struct{} 5 | 6 | func (EvalNoop) Eval(EvalContext) (interface{}, error) { 7 | return nil, nil 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_provisioner.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // EvalInitProvisioner is an EvalNode implementation that initializes a provisioner 8 | // and returns nothing. The provisioner can be retrieved again with the 9 | // EvalGetProvisioner node. 10 | type EvalInitProvisioner struct { 11 | Name string 12 | } 13 | 14 | func (n *EvalInitProvisioner) Eval(ctx EvalContext) (interface{}, error) { 15 | return ctx.InitProvisioner(n.Name) 16 | } 17 | 18 | // EvalCloseProvisioner is an EvalNode implementation that closes provisioner 19 | // connections that aren't needed anymore. 20 | type EvalCloseProvisioner struct { 21 | Name string 22 | } 23 | 24 | func (n *EvalCloseProvisioner) Eval(ctx EvalContext) (interface{}, error) { 25 | ctx.CloseProvisioner(n.Name) 26 | return nil, nil 27 | } 28 | 29 | // EvalGetProvisioner is an EvalNode implementation that retrieves an already 30 | // initialized provisioner instance for the given name. 31 | type EvalGetProvisioner struct { 32 | Name string 33 | Output *ResourceProvisioner 34 | } 35 | 36 | func (n *EvalGetProvisioner) Eval(ctx EvalContext) (interface{}, error) { 37 | result := ctx.Provisioner(n.Name) 38 | if result == nil { 39 | return nil, fmt.Errorf("provisioner %s not initialized", n.Name) 40 | } 41 | 42 | if n.Output != nil { 43 | *n.Output = result 44 | } 45 | 46 | return result, nil 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_refresh.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | ) 7 | 8 | // EvalRefresh is an EvalNode implementation that does a refresh for 9 | // a resource. 10 | type EvalRefresh struct { 11 | Provider *ResourceProvider 12 | State **InstanceState 13 | Info *InstanceInfo 14 | Output **InstanceState 15 | } 16 | 17 | // TODO: test 18 | func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) { 19 | provider := *n.Provider 20 | state := *n.State 21 | 22 | // If we have no state, we don't do any refreshing 23 | if state == nil { 24 | log.Printf("[DEBUG] refresh: %s: no state, not refreshing", n.Info.Id) 25 | return nil, nil 26 | } 27 | 28 | // Call pre-refresh hook 29 | err := ctx.Hook(func(h Hook) (HookAction, error) { 30 | return h.PreRefresh(n.Info, state) 31 | }) 32 | if err != nil { 33 | return nil, err 34 | } 35 | 36 | // Refresh! 37 | state, err = provider.Refresh(n.Info, state) 38 | if err != nil { 39 | return nil, fmt.Errorf("%s: %s", n.Info.Id, err.Error()) 40 | } 41 | 42 | // Call post-refresh hook 43 | err = ctx.Hook(func(h Hook) (HookAction, error) { 44 | return h.PostRefresh(n.Info, state) 45 | }) 46 | if err != nil { 47 | return nil, err 48 | } 49 | 50 | if n.Output != nil { 51 | *n.Output = state 52 | } 53 | 54 | return nil, nil 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_resource.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalInstanceInfo is an EvalNode implementation that fills in the 4 | // InstanceInfo as much as it can. 5 | type EvalInstanceInfo struct { 6 | Info *InstanceInfo 7 | } 8 | 9 | // TODO: test 10 | func (n *EvalInstanceInfo) Eval(ctx EvalContext) (interface{}, error) { 11 | n.Info.ModulePath = ctx.Path() 12 | return nil, nil 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalSequence is an EvalNode that evaluates in sequence. 4 | type EvalSequence struct { 5 | Nodes []EvalNode 6 | } 7 | 8 | func (n *EvalSequence) Eval(ctx EvalContext) (interface{}, error) { 9 | for _, n := range n.Nodes { 10 | if _, err := EvalRaw(n, ctx); err != nil { 11 | return nil, err 12 | } 13 | } 14 | 15 | return nil, nil 16 | } 17 | 18 | // EvalNodeFilterable impl. 19 | func (n *EvalSequence) Filter(fn EvalNodeFilterFunc) { 20 | for i, node := range n.Nodes { 21 | n.Nodes[i] = fn(node) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_config_node.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // graphNodeConfig is an interface that all graph nodes for the 8 | // configuration graph need to implement in order to build the variable 9 | // dependencies properly. 10 | type graphNodeConfig interface { 11 | dag.NamedVertex 12 | 13 | // All graph nodes should be dependent on other things, and able to 14 | // be depended on. 15 | GraphNodeDependable 16 | GraphNodeDependent 17 | 18 | // ConfigType returns the type of thing in the configuration that 19 | // this node represents, such as a resource, module, etc. 20 | ConfigType() GraphNodeConfigType 21 | } 22 | 23 | // GraphNodeAddressable is an interface that all graph nodes for the 24 | // configuration graph need to implement in order to be be addressed / targeted 25 | // properly. 26 | type GraphNodeAddressable interface { 27 | ResourceAddress() *ResourceAddress 28 | } 29 | 30 | // GraphNodeTargetable is an interface for graph nodes to implement when they 31 | // need to be told about incoming targets. This is useful for nodes that need 32 | // to respect targets as they dynamically expand. Note that the list of targets 33 | // provided will contain every target provided, and each implementing graph 34 | // node must filter this list to targets considered relevant. 35 | type GraphNodeTargetable interface { 36 | SetTargets([]ResourceAddress) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_config_node_type.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | //go:generate stringer -type=GraphNodeConfigType graph_config_node_type.go 4 | 5 | // GraphNodeConfigType is an enum for the type of thing that a graph 6 | // node represents from the configuration. 7 | type GraphNodeConfigType int 8 | 9 | const ( 10 | GraphNodeConfigTypeInvalid GraphNodeConfigType = 0 11 | GraphNodeConfigTypeResource GraphNodeConfigType = iota 12 | GraphNodeConfigTypeProvider 13 | GraphNodeConfigTypeModule 14 | GraphNodeConfigTypeOutput 15 | GraphNodeConfigTypeVariable 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_dot.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import "github.com/hashicorp/terraform/dag" 4 | 5 | // GraphDot returns the dot formatting of a visual representation of 6 | // the given Terraform graph. 7 | func GraphDot(g *Graph, opts *dag.DotOpts) (string, error) { 8 | return string(g.Dot(opts)), nil 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_interface_subgraph.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // GraphNodeSubPath says that a node is part of a graph with a 4 | // different path, and the context should be adjusted accordingly. 5 | type GraphNodeSubPath interface { 6 | Path() []string 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_walk_operation.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | //go:generate stringer -type=walkOperation graph_walk_operation.go 4 | 5 | // walkOperation is an enum which tells the walkContext what to do. 6 | type walkOperation byte 7 | 8 | const ( 9 | walkInvalid walkOperation = iota 10 | walkInput 11 | walkApply 12 | walkPlan 13 | walkPlanDestroy 14 | walkRefresh 15 | walkValidate 16 | walkDestroy 17 | walkImport 18 | ) 19 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graphnodeconfigtype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=GraphNodeConfigType graph_config_node_type.go"; DO NOT EDIT 2 | 3 | package terraform 4 | 5 | import "fmt" 6 | 7 | const _GraphNodeConfigType_name = "GraphNodeConfigTypeInvalidGraphNodeConfigTypeResourceGraphNodeConfigTypeProviderGraphNodeConfigTypeModuleGraphNodeConfigTypeOutputGraphNodeConfigTypeVariable" 8 | 9 | var _GraphNodeConfigType_index = [...]uint8{0, 26, 53, 80, 105, 130, 157} 10 | 11 | func (i GraphNodeConfigType) String() string { 12 | if i < 0 || i >= GraphNodeConfigType(len(_GraphNodeConfigType_index)-1) { 13 | return fmt.Sprintf("GraphNodeConfigType(%d)", i) 14 | } 15 | return _GraphNodeConfigType_name[_GraphNodeConfigType_index[i]:_GraphNodeConfigType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/instancetype.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | //go:generate stringer -type=InstanceType instancetype.go 4 | 5 | // InstanceType is an enum of the various types of instances store in the State 6 | type InstanceType int 7 | 8 | const ( 9 | TypeInvalid InstanceType = iota 10 | TypePrimary 11 | TypeTainted 12 | TypeDeposed 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=InstanceType instancetype.go"; DO NOT EDIT 2 | 3 | package terraform 4 | 5 | import "fmt" 6 | 7 | const _InstanceType_name = "TypeInvalidTypePrimaryTypeTaintedTypeDeposed" 8 | 9 | var _InstanceType_index = [...]uint8{0, 11, 22, 33, 44} 10 | 11 | func (i InstanceType) String() string { 12 | if i < 0 || i >= InstanceType(len(_InstanceType_index)-1) { 13 | return fmt.Sprintf("InstanceType(%d)", i) 14 | } 15 | return _InstanceType_name[_InstanceType_index[i]:_InstanceType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_count_boundary.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // NodeCountBoundary fixes any "count boundarie" in the state: resources 4 | // that are named "foo.0" when they should be named "foo" 5 | type NodeCountBoundary struct{} 6 | 7 | func (n *NodeCountBoundary) Name() string { 8 | return "meta.count-boundary (count boundary fixup)" 9 | } 10 | 11 | // GraphNodeEvalable 12 | func (n *NodeCountBoundary) EvalTree() EvalNode { 13 | return &EvalCountFixZeroOneBoundaryGlobal{} 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_module_destroy.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // NodeDestroyableModule represents a module destruction. 8 | type NodeDestroyableModuleVariable struct { 9 | PathValue []string 10 | } 11 | 12 | func (n *NodeDestroyableModuleVariable) Name() string { 13 | result := "plan-destroy" 14 | if len(n.PathValue) > 1 { 15 | result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result) 16 | } 17 | 18 | return result 19 | } 20 | 21 | // GraphNodeSubPath 22 | func (n *NodeDestroyableModuleVariable) Path() []string { 23 | return n.PathValue 24 | } 25 | 26 | // GraphNodeEvalable 27 | func (n *NodeDestroyableModuleVariable) EvalTree() EvalNode { 28 | return &EvalDiffDestroyModule{Path: n.PathValue} 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_output_orphan.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // NodeOutputOrphan represents an output that is an orphan. 8 | type NodeOutputOrphan struct { 9 | OutputName string 10 | PathValue []string 11 | } 12 | 13 | func (n *NodeOutputOrphan) Name() string { 14 | result := fmt.Sprintf("output.%s (orphan)", n.OutputName) 15 | if len(n.PathValue) > 1 { 16 | result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result) 17 | } 18 | 19 | return result 20 | } 21 | 22 | // GraphNodeSubPath 23 | func (n *NodeOutputOrphan) Path() []string { 24 | return n.PathValue 25 | } 26 | 27 | // GraphNodeEvalable 28 | func (n *NodeOutputOrphan) EvalTree() EvalNode { 29 | return &EvalOpFilter{ 30 | Ops: []walkOperation{walkRefresh, walkApply, walkDestroy}, 31 | Node: &EvalDeleteOutput{ 32 | Name: n.OutputName, 33 | }, 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_provider.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/config" 7 | ) 8 | 9 | // NodeApplyableProvider represents a provider during an apply. 10 | // 11 | // NOTE: There is a lot of logic here that will be shared with non-Apply. 12 | // The plan is to abstract that eventually into an embedded abstract struct. 13 | type NodeApplyableProvider struct { 14 | NameValue string 15 | PathValue []string 16 | Config *config.ProviderConfig 17 | } 18 | 19 | func (n *NodeApplyableProvider) Name() string { 20 | result := fmt.Sprintf("provider.%s", n.NameValue) 21 | if len(n.PathValue) > 1 { 22 | result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result) 23 | } 24 | 25 | return result 26 | } 27 | 28 | // GraphNodeSubPath 29 | func (n *NodeApplyableProvider) Path() []string { 30 | return n.PathValue 31 | } 32 | 33 | // GraphNodeReferencer 34 | func (n *NodeApplyableProvider) References() []string { 35 | if n.Config == nil { 36 | return nil 37 | } 38 | 39 | return ReferencesFromConfig(n.Config.RawConfig) 40 | } 41 | 42 | // GraphNodeProvider 43 | func (n *NodeApplyableProvider) ProviderName() string { 44 | return n.NameValue 45 | } 46 | 47 | // GraphNodeProvider 48 | func (n *NodeApplyableProvider) ProviderConfig() *config.RawConfig { 49 | if n.Config == nil { 50 | return nil 51 | } 52 | 53 | return n.Config.RawConfig 54 | } 55 | 56 | // GraphNodeAttachProvider 57 | func (n *NodeApplyableProvider) AttachProvider(c *config.ProviderConfig) { 58 | n.Config = c 59 | } 60 | 61 | // GraphNodeEvalable 62 | func (n *NodeApplyableProvider) EvalTree() EvalNode { 63 | return ProviderEvalTree(n.NameValue, n.ProviderConfig()) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/config" 7 | ) 8 | 9 | // NodeAbstractProvider represents a provider that has no associated operations. 10 | // It registers all the common interfaces across operations for providers. 11 | type NodeAbstractProvider struct { 12 | NameValue string 13 | PathValue []string 14 | 15 | // The fields below will be automatically set using the Attach 16 | // interfaces if you're running those transforms, but also be explicitly 17 | // set if you already have that information. 18 | 19 | Config *config.ProviderConfig 20 | } 21 | 22 | func (n *NodeAbstractProvider) Name() string { 23 | result := fmt.Sprintf("provider.%s", n.NameValue) 24 | if len(n.PathValue) > 1 { 25 | result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result) 26 | } 27 | 28 | return result 29 | } 30 | 31 | // GraphNodeSubPath 32 | func (n *NodeAbstractProvider) Path() []string { 33 | return n.PathValue 34 | } 35 | 36 | // GraphNodeReferencer 37 | func (n *NodeAbstractProvider) References() []string { 38 | if n.Config == nil { 39 | return nil 40 | } 41 | 42 | return ReferencesFromConfig(n.Config.RawConfig) 43 | } 44 | 45 | // GraphNodeProvider 46 | func (n *NodeAbstractProvider) ProviderName() string { 47 | return n.NameValue 48 | } 49 | 50 | // GraphNodeProvider 51 | func (n *NodeAbstractProvider) ProviderConfig() *config.RawConfig { 52 | if n.Config == nil { 53 | return nil 54 | } 55 | 56 | return n.Config.RawConfig 57 | } 58 | 59 | // GraphNodeAttachProvider 60 | func (n *NodeAbstractProvider) AttachProvider(c *config.ProviderConfig) { 61 | n.Config = c 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_provider_disabled.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // NodeDisabledProvider represents a provider that is disabled. A disabled 8 | // provider does nothing. It exists to properly set inheritance information 9 | // for child providers. 10 | type NodeDisabledProvider struct { 11 | *NodeAbstractProvider 12 | } 13 | 14 | func (n *NodeDisabledProvider) Name() string { 15 | return fmt.Sprintf("%s (disabled)", n.NodeAbstractProvider.Name()) 16 | } 17 | 18 | // GraphNodeEvalable 19 | func (n *NodeDisabledProvider) EvalTree() EvalNode { 20 | var resourceConfig *ResourceConfig 21 | return &EvalSequence{ 22 | Nodes: []EvalNode{ 23 | &EvalInterpolate{ 24 | Config: n.ProviderConfig(), 25 | Output: &resourceConfig, 26 | }, 27 | &EvalBuildProviderConfig{ 28 | Provider: n.ProviderName(), 29 | Config: &resourceConfig, 30 | Output: &resourceConfig, 31 | }, 32 | &EvalSetProviderConfig{ 33 | Provider: n.ProviderName(), 34 | Config: &resourceConfig, 35 | }, 36 | }, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // NodePlanDestroyableResource represents a resource that is "applyable": 8 | // it is ready to be applied and is represented by a diff. 9 | type NodePlanDestroyableResource struct { 10 | *NodeAbstractResource 11 | } 12 | 13 | // GraphNodeDestroyer 14 | func (n *NodePlanDestroyableResource) DestroyAddr() *ResourceAddress { 15 | return n.Addr 16 | } 17 | 18 | // GraphNodeEvalable 19 | func (n *NodePlanDestroyableResource) EvalTree() EvalNode { 20 | addr := n.NodeAbstractResource.Addr 21 | 22 | // stateId is the ID to put into the state 23 | stateId := addr.stateId() 24 | if addr.Index > -1 { 25 | stateId = fmt.Sprintf("%s.%d", stateId, addr.Index) 26 | } 27 | 28 | // Build the instance info. More of this will be populated during eval 29 | info := &InstanceInfo{ 30 | Id: stateId, 31 | Type: addr.Type, 32 | } 33 | 34 | // Declare a bunch of variables that are used for state during 35 | // evaluation. Most of this are written to by-address below. 36 | var diff *InstanceDiff 37 | var state *InstanceState 38 | 39 | return &EvalSequence{ 40 | Nodes: []EvalNode{ 41 | &EvalReadState{ 42 | Name: stateId, 43 | Output: &state, 44 | }, 45 | &EvalDiffDestroy{ 46 | Info: info, 47 | State: &state, 48 | Output: &diff, 49 | }, 50 | &EvalCheckPreventDestroy{ 51 | Resource: n.Config, 52 | Diff: &diff, 53 | }, 54 | &EvalWriteDiff{ 55 | Name: stateId, 56 | Diff: &diff, 57 | }, 58 | }, 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_orphan.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // NodePlannableResourceOrphan represents a resource that is "applyable": 8 | // it is ready to be applied and is represented by a diff. 9 | type NodePlannableResourceOrphan struct { 10 | *NodeAbstractResource 11 | } 12 | 13 | func (n *NodePlannableResourceOrphan) Name() string { 14 | return n.NodeAbstractResource.Name() + " (orphan)" 15 | } 16 | 17 | // GraphNodeEvalable 18 | func (n *NodePlannableResourceOrphan) EvalTree() EvalNode { 19 | addr := n.NodeAbstractResource.Addr 20 | 21 | // stateId is the ID to put into the state 22 | stateId := addr.stateId() 23 | if addr.Index > -1 { 24 | stateId = fmt.Sprintf("%s.%d", stateId, addr.Index) 25 | } 26 | 27 | // Build the instance info. More of this will be populated during eval 28 | info := &InstanceInfo{ 29 | Id: stateId, 30 | Type: addr.Type, 31 | ModulePath: normalizeModulePath(addr.Path), 32 | } 33 | 34 | // Declare a bunch of variables that are used for state during 35 | // evaluation. Most of this are written to by-address below. 36 | var diff *InstanceDiff 37 | var state *InstanceState 38 | 39 | return &EvalSequence{ 40 | Nodes: []EvalNode{ 41 | &EvalReadState{ 42 | Name: stateId, 43 | Output: &state, 44 | }, 45 | &EvalDiffDestroy{ 46 | Info: info, 47 | State: &state, 48 | Output: &diff, 49 | }, 50 | &EvalCheckPreventDestroy{ 51 | Resource: n.Config, 52 | ResourceId: stateId, 53 | Diff: &diff, 54 | }, 55 | &EvalWriteDiff{ 56 | Name: stateId, 57 | Diff: &diff, 58 | }, 59 | }, 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/node_root_variable.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/config" 7 | ) 8 | 9 | // NodeRootVariable represents a root variable input. 10 | type NodeRootVariable struct { 11 | Config *config.Variable 12 | } 13 | 14 | func (n *NodeRootVariable) Name() string { 15 | result := fmt.Sprintf("var.%s", n.Config.Name) 16 | return result 17 | } 18 | 19 | // GraphNodeReferenceable 20 | func (n *NodeRootVariable) ReferenceableName() []string { 21 | return []string{n.Name()} 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/path.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | ) 7 | 8 | // PathCacheKey returns a cache key for a module path. 9 | // 10 | // TODO: test 11 | func PathCacheKey(path []string) string { 12 | // There is probably a better way to do this, but this is working for now. 13 | // We just create an MD5 hash of all the MD5 hashes of all the path 14 | // elements. This gets us the property that it is unique per ordering. 15 | hash := md5.New() 16 | for _, p := range path { 17 | single := md5.Sum([]byte(p)) 18 | if _, err := hash.Write(single[:]); err != nil { 19 | panic(err) 20 | } 21 | } 22 | 23 | return hex.EncodeToString(hash.Sum(nil)) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // ResourceProvisioner is an interface that must be implemented by any 4 | // resource provisioner: the thing that initializes resources in 5 | // a Terraform configuration. 6 | type ResourceProvisioner interface { 7 | // Validate is called once at the beginning with the raw 8 | // configuration (no interpolation done) and can return a list of warnings 9 | // and/or errors. 10 | // 11 | // This is called once per resource. 12 | // 13 | // This should not assume any of the values in the resource configuration 14 | // are valid since it is possible they have to be interpolated still. 15 | // The primary use case of this call is to check that the required keys 16 | // are set and that the general structure is correct. 17 | Validate(*ResourceConfig) ([]string, []error) 18 | 19 | // Apply runs the provisioner on a specific resource and returns the new 20 | // resource state along with an error. Instead of a diff, the ResourceConfig 21 | // is provided since provisioners only run after a resource has been 22 | // newly created. 23 | Apply(UIOutput, *InstanceState, *ResourceConfig) error 24 | } 25 | 26 | // ResourceProvisionerCloser is an interface that provisioners that can close 27 | // connections that aren't needed anymore must implement. 28 | type ResourceProvisionerCloser interface { 29 | Close() error 30 | } 31 | 32 | // ResourceProvisionerFactory is a function type that creates a new instance 33 | // of a resource provisioner. 34 | type ResourceProvisionerFactory func() (ResourceProvisioner, error) 35 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import "sync" 4 | 5 | // MockResourceProvisioner implements ResourceProvisioner but mocks out all the 6 | // calls for testing purposes. 7 | type MockResourceProvisioner struct { 8 | sync.Mutex 9 | // Anything you want, in case you need to store extra data with the mock. 10 | Meta interface{} 11 | 12 | ApplyCalled bool 13 | ApplyOutput UIOutput 14 | ApplyState *InstanceState 15 | ApplyConfig *ResourceConfig 16 | ApplyFn func(*InstanceState, *ResourceConfig) error 17 | ApplyReturnError error 18 | 19 | ValidateCalled bool 20 | ValidateConfig *ResourceConfig 21 | ValidateFn func(c *ResourceConfig) ([]string, []error) 22 | ValidateReturnWarns []string 23 | ValidateReturnErrors []error 24 | } 25 | 26 | func (p *MockResourceProvisioner) Validate(c *ResourceConfig) ([]string, []error) { 27 | p.Lock() 28 | defer p.Unlock() 29 | 30 | p.ValidateCalled = true 31 | p.ValidateConfig = c 32 | if p.ValidateFn != nil { 33 | return p.ValidateFn(c) 34 | } 35 | return p.ValidateReturnWarns, p.ValidateReturnErrors 36 | } 37 | 38 | func (p *MockResourceProvisioner) Apply( 39 | output UIOutput, 40 | state *InstanceState, 41 | c *ResourceConfig) error { 42 | p.Lock() 43 | defer p.Unlock() 44 | 45 | p.ApplyCalled = true 46 | p.ApplyOutput = output 47 | p.ApplyState = state 48 | p.ApplyConfig = c 49 | if p.ApplyFn != nil { 50 | return p.ApplyFn(state, c) 51 | } 52 | return p.ApplyReturnError 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/shadow.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // Shadow is the interface that any "shadow" structures must implement. 4 | // 5 | // A shadow structure is an interface implementation (typically) that 6 | // shadows a real implementation and verifies that the same behavior occurs 7 | // on both. The semantics of this behavior are up to the interface itself. 8 | // 9 | // A shadow NEVER modifies real values or state. It must always be safe to use. 10 | // 11 | // For example, a ResourceProvider shadow ensures that the same operations 12 | // are done on the same resources with the same configurations. 13 | // 14 | // The typical usage of a shadow following this interface is to complete 15 | // the real operations, then call CloseShadow which tells the shadow that 16 | // the real side is done. Then, once the shadow is also complete, call 17 | // ShadowError to find any errors that may have been caught. 18 | type Shadow interface { 19 | // CloseShadow tells the shadow that the REAL implementation is 20 | // complete. Therefore, any calls that would block should now return 21 | // immediately since no more changes will happen to the real side. 22 | CloseShadow() error 23 | 24 | // ShadowError returns the errors that the shadow has found. 25 | // This should be called AFTER CloseShadow and AFTER the shadow is 26 | // known to be complete (no more calls to it). 27 | ShadowError() error 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // GraphTransformer is the interface that transformers implement. This 8 | // interface is only for transforms that need entire graph visibility. 9 | type GraphTransformer interface { 10 | Transform(*Graph) error 11 | } 12 | 13 | // GraphVertexTransformer is an interface that transforms a single 14 | // Vertex within with graph. This is a specialization of GraphTransformer 15 | // that makes it easy to do vertex replacement. 16 | // 17 | // The GraphTransformer that runs through the GraphVertexTransformers is 18 | // VertexTransformer. 19 | type GraphVertexTransformer interface { 20 | Transform(dag.Vertex) (dag.Vertex, error) 21 | } 22 | 23 | // GraphTransformIf is a helper function that conditionally returns a 24 | // GraphTransformer given. This is useful for calling inline a sequence 25 | // of transforms without having to split it up into multiple append() calls. 26 | func GraphTransformIf(f func() bool, then GraphTransformer) GraphTransformer { 27 | if f() { 28 | return then 29 | } 30 | 31 | return nil 32 | } 33 | 34 | type graphTransformerMulti struct { 35 | Transforms []GraphTransformer 36 | } 37 | 38 | func (t *graphTransformerMulti) Transform(g *Graph) error { 39 | for _, t := range t.Transforms { 40 | if err := t.Transform(g); err != nil { 41 | return err 42 | } 43 | } 44 | 45 | return nil 46 | } 47 | 48 | // GraphTransformMulti combines multiple graph transformers into a single 49 | // GraphTransformer that runs all the individual graph transformers. 50 | func GraphTransformMulti(ts ...GraphTransformer) GraphTransformer { 51 | return &graphTransformerMulti{Transforms: ts} 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_count_boundary.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // CountBoundaryTransformer adds a node that depends on everything else 8 | // so that it runs last in order to clean up the state for nodes that 9 | // are on the "count boundary": "foo.0" when only one exists becomes "foo" 10 | type CountBoundaryTransformer struct{} 11 | 12 | func (t *CountBoundaryTransformer) Transform(g *Graph) error { 13 | node := &NodeCountBoundary{} 14 | g.Add(node) 15 | 16 | // Depends on everything 17 | for _, v := range g.Vertices() { 18 | // Don't connect to ourselves 19 | if v == node { 20 | continue 21 | } 22 | 23 | // Connect! 24 | g.Connect(dag.BasicEdge(node, v)) 25 | } 26 | 27 | return nil 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_import_provider.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // ImportProviderValidateTransformer is a GraphTransformer that goes through 9 | // the providers in the graph and validates that they only depend on variables. 10 | type ImportProviderValidateTransformer struct{} 11 | 12 | func (t *ImportProviderValidateTransformer) Transform(g *Graph) error { 13 | for _, v := range g.Vertices() { 14 | // We only care about providers 15 | pv, ok := v.(GraphNodeProvider) 16 | if !ok { 17 | continue 18 | } 19 | 20 | // We only care about providers that reference things 21 | rn, ok := pv.(GraphNodeReferencer) 22 | if !ok { 23 | continue 24 | } 25 | 26 | for _, ref := range rn.References() { 27 | if !strings.HasPrefix(ref, "var.") { 28 | return fmt.Errorf( 29 | "Provider %q depends on non-var %q. Providers for import can currently\n"+ 30 | "only depend on variables or must be hardcoded. You can stop import\n"+ 31 | "from loading configurations by specifying `-config=\"\"`.", 32 | pv.ProviderName(), ref) 33 | } 34 | } 35 | } 36 | 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_module_destroy_old.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // ModuleDestroyTransformer is a GraphTransformer that adds a node 10 | // to the graph that will just mark the full module for destroy in 11 | // the destroy scenario. 12 | type ModuleDestroyTransformerOld struct{} 13 | 14 | func (t *ModuleDestroyTransformerOld) Transform(g *Graph) error { 15 | // Create the node 16 | n := &graphNodeModuleDestroy{Path: g.Path} 17 | 18 | // Add it to the graph. We don't need any edges because 19 | // it can happen whenever. 20 | g.Add(n) 21 | 22 | return nil 23 | } 24 | 25 | type graphNodeModuleDestroy struct { 26 | Path []string 27 | } 28 | 29 | func (n *graphNodeModuleDestroy) Name() string { 30 | return "plan-destroy" 31 | } 32 | 33 | // GraphNodeEvalable impl. 34 | func (n *graphNodeModuleDestroy) EvalTree() EvalNode { 35 | return &EvalOpFilter{ 36 | Ops: []walkOperation{walkPlanDestroy}, 37 | Node: &EvalDiffDestroyModule{Path: n.Path}, 38 | } 39 | } 40 | 41 | // GraphNodeFlattenable impl. 42 | func (n *graphNodeModuleDestroy) Flatten(p []string) (dag.Vertex, error) { 43 | return &graphNodeModuleDestroyFlat{ 44 | graphNodeModuleDestroy: n, 45 | PathValue: p, 46 | }, nil 47 | } 48 | 49 | type graphNodeModuleDestroyFlat struct { 50 | *graphNodeModuleDestroy 51 | 52 | PathValue []string 53 | } 54 | 55 | func (n *graphNodeModuleDestroyFlat) Name() string { 56 | return fmt.Sprintf( 57 | "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeModuleDestroy.Name()) 58 | } 59 | 60 | func (n *graphNodeModuleDestroyFlat) Path() []string { 61 | return n.PathValue 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_orphan_output.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/hashicorp/terraform/config" 7 | "github.com/hashicorp/terraform/config/module" 8 | ) 9 | 10 | // OrphanOutputTransformer finds the outputs that aren't present 11 | // in the given config that are in the state and adds them to the graph 12 | // for deletion. 13 | type OrphanOutputTransformer struct { 14 | Module *module.Tree // Root module 15 | State *State // State is the root state 16 | } 17 | 18 | func (t *OrphanOutputTransformer) Transform(g *Graph) error { 19 | if t.State == nil { 20 | log.Printf("[DEBUG] No state, no orphan outputs") 21 | return nil 22 | } 23 | 24 | return t.transform(g, t.Module) 25 | } 26 | 27 | func (t *OrphanOutputTransformer) transform(g *Graph, m *module.Tree) error { 28 | // Get our configuration, and recurse into children 29 | var c *config.Config 30 | if m != nil { 31 | c = m.Config() 32 | for _, child := range m.Children() { 33 | if err := t.transform(g, child); err != nil { 34 | return err 35 | } 36 | } 37 | } 38 | 39 | // Get the state. If there is no state, then we have no orphans! 40 | path := normalizeModulePath(m.Path()) 41 | state := t.State.ModuleByPath(path) 42 | if state == nil { 43 | return nil 44 | } 45 | 46 | // Make a map of the valid outputs 47 | valid := make(map[string]struct{}) 48 | for _, o := range c.Outputs { 49 | valid[o.Name] = struct{}{} 50 | } 51 | 52 | // Go through the outputs and find the ones that aren't in our config. 53 | for n, _ := range state.Outputs { 54 | // If it is in the valid map, then ignore 55 | if _, ok := valid[n]; ok { 56 | continue 57 | } 58 | 59 | // Orphan! 60 | g.Add(&NodeOutputOrphan{OutputName: n, PathValue: path}) 61 | } 62 | 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_output.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/config/module" 5 | ) 6 | 7 | // OutputTransformer is a GraphTransformer that adds all the outputs 8 | // in the configuration to the graph. 9 | // 10 | // This is done for the apply graph builder even if dependent nodes 11 | // aren't changing since there is no downside: the state will be available 12 | // even if the dependent items aren't changing. 13 | type OutputTransformer struct { 14 | Module *module.Tree 15 | } 16 | 17 | func (t *OutputTransformer) Transform(g *Graph) error { 18 | return t.transform(g, t.Module) 19 | } 20 | 21 | func (t *OutputTransformer) transform(g *Graph, m *module.Tree) error { 22 | // If no config, no outputs 23 | if m == nil { 24 | return nil 25 | } 26 | 27 | // Transform all the children. We must do this first because 28 | // we can reference module outputs and they must show up in the 29 | // reference map. 30 | for _, c := range m.Children() { 31 | if err := t.transform(g, c); err != nil { 32 | return err 33 | } 34 | } 35 | 36 | // If we have no outputs, we're done! 37 | os := m.Config().Outputs 38 | if len(os) == 0 { 39 | return nil 40 | } 41 | 42 | // Add all outputs here 43 | for _, o := range os { 44 | // Build the node. 45 | // 46 | // NOTE: For now this is just an "applyable" output. As we build 47 | // new graph builders for the other operations I suspect we'll 48 | // find a way to parameterize this, require new transforms, etc. 49 | node := &NodeApplyableOutput{ 50 | PathValue: normalizeModulePath(m.Path()), 51 | Config: o, 52 | } 53 | 54 | // Add it! 55 | g.Add(node) 56 | } 57 | 58 | return nil 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_provider_disable.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // DisableProviderTransformer "disables" any providers that are not actually 10 | // used by anything. This avoids the provider being initialized and configured. 11 | // This both saves resources but also avoids errors since configuration 12 | // may imply initialization which may require auth. 13 | type DisableProviderTransformer struct{} 14 | 15 | func (t *DisableProviderTransformer) Transform(g *Graph) error { 16 | for _, v := range g.Vertices() { 17 | // We only care about providers 18 | pn, ok := v.(GraphNodeProvider) 19 | if !ok || pn.ProviderName() == "" { 20 | continue 21 | } 22 | 23 | // If we have dependencies, then don't disable 24 | if g.UpEdges(v).Len() > 0 { 25 | continue 26 | } 27 | 28 | // Get the path 29 | var path []string 30 | if pn, ok := v.(GraphNodeSubPath); ok { 31 | path = pn.Path() 32 | } 33 | 34 | // Disable the provider by replacing it with a "disabled" provider 35 | disabled := &NodeDisabledProvider{ 36 | NodeAbstractProvider: &NodeAbstractProvider{ 37 | NameValue: pn.ProviderName(), 38 | PathValue: path, 39 | }, 40 | } 41 | 42 | if !g.Replace(v, disabled) { 43 | panic(fmt.Sprintf( 44 | "vertex disappeared from under us: %s", 45 | dag.VertexName(v))) 46 | } 47 | } 48 | 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_proxy.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // GraphNodeProxy must be implemented by nodes that are proxies. 8 | // 9 | // A node that is a proxy says that anything that depends on this 10 | // node (the proxy), should also copy all the things that the proxy 11 | // itself depends on. Example: 12 | // 13 | // A => proxy => C 14 | // 15 | // Should transform into (two edges): 16 | // 17 | // A => proxy => C 18 | // A => C 19 | // 20 | // The purpose for this is because some transforms only look at direct 21 | // edge connections and the proxy generally isn't meaningful in those 22 | // situations, so we should complete all the edges. 23 | type GraphNodeProxy interface { 24 | Proxy() bool 25 | } 26 | 27 | // ProxyTransformer is a transformer that goes through the graph, finds 28 | // vertices that are marked as proxies, and connects through their 29 | // dependents. See above for what a proxy is. 30 | type ProxyTransformer struct{} 31 | 32 | func (t *ProxyTransformer) Transform(g *Graph) error { 33 | for _, v := range g.Vertices() { 34 | pn, ok := v.(GraphNodeProxy) 35 | if !ok { 36 | continue 37 | } 38 | 39 | // If we don't want to be proxies, don't do it 40 | if !pn.Proxy() { 41 | continue 42 | } 43 | 44 | // Connect all the things that depend on this to things that 45 | // we depend on as the proxy. See docs for GraphNodeProxy for 46 | // a visual explanation. 47 | for _, s := range g.UpEdges(v).List() { 48 | for _, t := range g.DownEdges(v).List() { 49 | g.Connect(GraphProxyEdge{ 50 | Edge: dag.BasicEdge(s, t), 51 | }) 52 | } 53 | } 54 | } 55 | 56 | return nil 57 | } 58 | 59 | // GraphProxyEdge is the edge that is used for proxied edges. 60 | type GraphProxyEdge struct { 61 | dag.Edge 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_resource_count.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // ResourceCountTransformer is a GraphTransformer that expands the count 10 | // out for a specific resource. 11 | // 12 | // This assumes that the count is already interpolated. 13 | type ResourceCountTransformer struct { 14 | Concrete ConcreteResourceNodeFunc 15 | 16 | Count int 17 | Addr *ResourceAddress 18 | } 19 | 20 | func (t *ResourceCountTransformer) Transform(g *Graph) error { 21 | // Don't allow the count to be negative 22 | if t.Count < 0 { 23 | return fmt.Errorf("negative count: %d", t.Count) 24 | } 25 | 26 | // For each count, build and add the node 27 | for i := 0; i < t.Count; i++ { 28 | // Set the index. If our count is 1 we special case it so that 29 | // we handle the "resource.0" and "resource" boundary properly. 30 | index := i 31 | if t.Count == 1 { 32 | index = -1 33 | } 34 | 35 | // Build the resource address 36 | addr := t.Addr.Copy() 37 | addr.Index = index 38 | 39 | // Build the abstract node and the concrete one 40 | abstract := &NodeAbstractResource{Addr: addr} 41 | var node dag.Vertex = abstract 42 | if f := t.Concrete; f != nil { 43 | node = f(abstract) 44 | } 45 | 46 | // Add it to the graph 47 | g.Add(node) 48 | } 49 | 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_root.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import "github.com/hashicorp/terraform/dag" 4 | 5 | const rootNodeName = "root" 6 | 7 | // RootTransformer is a GraphTransformer that adds a root to the graph. 8 | type RootTransformer struct{} 9 | 10 | func (t *RootTransformer) Transform(g *Graph) error { 11 | // If we already have a good root, we're done 12 | if _, err := g.Root(); err == nil { 13 | return nil 14 | } 15 | 16 | // Add a root 17 | var root graphNodeRoot 18 | g.Add(root) 19 | 20 | // Connect the root to all the edges that need it 21 | for _, v := range g.Vertices() { 22 | if v == root { 23 | continue 24 | } 25 | 26 | if g.UpEdges(v).Len() == 0 { 27 | g.Connect(dag.BasicEdge(root, v)) 28 | } 29 | } 30 | 31 | return nil 32 | } 33 | 34 | type graphNodeRoot struct{} 35 | 36 | func (n graphNodeRoot) Name() string { 37 | return rootNodeName 38 | } 39 | 40 | func (n graphNodeRoot) Flatten(p []string) (dag.Vertex, error) { 41 | return n, nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_transitive_reduction.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // TransitiveReductionTransformer is a GraphTransformer that performs 4 | // finds the transitive reduction of the graph. For a definition of 5 | // transitive reduction, see Wikipedia. 6 | type TransitiveReductionTransformer struct{} 7 | 8 | func (t *TransitiveReductionTransformer) Transform(g *Graph) error { 9 | // If the graph isn't valid, skip the transitive reduction. 10 | // We don't error here because Terraform itself handles graph 11 | // validation in a better way, or we assume it does. 12 | if err := g.Validate(); err != nil { 13 | return nil 14 | } 15 | 16 | // Do it 17 | g.TransitiveReduction() 18 | 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_variable.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/config/module" 5 | ) 6 | 7 | // RootVariableTransformer is a GraphTransformer that adds all the root 8 | // variables to the graph. 9 | // 10 | // Root variables are currently no-ops but they must be added to the 11 | // graph since downstream things that depend on them must be able to 12 | // reach them. 13 | type RootVariableTransformer struct { 14 | Module *module.Tree 15 | } 16 | 17 | func (t *RootVariableTransformer) Transform(g *Graph) error { 18 | // If no config, no variables 19 | if t.Module == nil { 20 | return nil 21 | } 22 | 23 | // If we have no vars, we're done! 24 | vars := t.Module.Config().Variables 25 | if len(vars) == 0 { 26 | return nil 27 | } 28 | 29 | // Add all variables here 30 | for _, v := range vars { 31 | node := &NodeRootVariable{ 32 | Config: v, 33 | } 34 | 35 | // Add it! 36 | g.Add(node) 37 | } 38 | 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_vertex.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // VertexTransformer is a GraphTransformer that transforms vertices 10 | // using the GraphVertexTransformers. The Transforms are run in sequential 11 | // order. If a transform replaces a vertex then the next transform will see 12 | // the new vertex. 13 | type VertexTransformer struct { 14 | Transforms []GraphVertexTransformer 15 | } 16 | 17 | func (t *VertexTransformer) Transform(g *Graph) error { 18 | for _, v := range g.Vertices() { 19 | for _, vt := range t.Transforms { 20 | newV, err := vt.Transform(v) 21 | if err != nil { 22 | return err 23 | } 24 | 25 | // If the vertex didn't change, then don't do anything more 26 | if newV == v { 27 | continue 28 | } 29 | 30 | // Vertex changed, replace it within the graph 31 | if ok := g.Replace(v, newV); !ok { 32 | // This should never happen, big problem 33 | return fmt.Errorf( 34 | "Failed to replace %s with %s!\n\nSource: %#v\n\nTarget: %#v", 35 | dag.VertexName(v), dag.VertexName(newV), v, newV) 36 | } 37 | 38 | // Replace v so that future transforms use the proper vertex 39 | v = newV 40 | } 41 | } 42 | 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_input.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // UIInput is the interface that must be implemented to ask for input 4 | // from this user. This should forward the request to wherever the user 5 | // inputs things to ask for values. 6 | type UIInput interface { 7 | Input(*InputOpts) (string, error) 8 | } 9 | 10 | // InputOpts are options for asking for input. 11 | type InputOpts struct { 12 | // Id is a unique ID for the question being asked that might be 13 | // used for logging or to look up a prior answered question. 14 | Id string 15 | 16 | // Query is a human-friendly question for inputting this value. 17 | Query string 18 | 19 | // Description is a description about what this option is. Be wary 20 | // that this will probably be in a terminal so split lines as you see 21 | // necessary. 22 | Description string 23 | 24 | // Default will be the value returned if no data is entered. 25 | Default string 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_input_mock.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // MockUIInput is an implementation of UIInput that can be used for tests. 4 | type MockUIInput struct { 5 | InputCalled bool 6 | InputOpts *InputOpts 7 | InputReturnMap map[string]string 8 | InputReturnString string 9 | InputReturnError error 10 | InputFn func(*InputOpts) (string, error) 11 | } 12 | 13 | func (i *MockUIInput) Input(opts *InputOpts) (string, error) { 14 | i.InputCalled = true 15 | i.InputOpts = opts 16 | if i.InputFn != nil { 17 | return i.InputFn(opts) 18 | } 19 | if i.InputReturnMap != nil { 20 | return i.InputReturnMap[opts.Id], i.InputReturnError 21 | } 22 | return i.InputReturnString, i.InputReturnError 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_input_prefix.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // PrefixUIInput is an implementation of UIInput that prefixes the ID 8 | // with a string, allowing queries to be namespaced. 9 | type PrefixUIInput struct { 10 | IdPrefix string 11 | QueryPrefix string 12 | UIInput UIInput 13 | } 14 | 15 | func (i *PrefixUIInput) Input(opts *InputOpts) (string, error) { 16 | opts.Id = fmt.Sprintf("%s.%s", i.IdPrefix, opts.Id) 17 | opts.Query = fmt.Sprintf("%s%s", i.QueryPrefix, opts.Query) 18 | return i.UIInput.Input(opts) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // UIOutput is the interface that must be implemented to output 4 | // data to the end user. 5 | type UIOutput interface { 6 | Output(string) 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output_callback.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | type CallbackUIOutput struct { 4 | OutputFn func(string) 5 | } 6 | 7 | func (o *CallbackUIOutput) Output(v string) { 8 | o.OutputFn(v) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output_mock.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // MockUIOutput is an implementation of UIOutput that can be used for tests. 4 | type MockUIOutput struct { 5 | OutputCalled bool 6 | OutputMessage string 7 | OutputFn func(string) 8 | } 9 | 10 | func (o *MockUIOutput) Output(v string) { 11 | o.OutputCalled = true 12 | o.OutputMessage = v 13 | if o.OutputFn != nil { 14 | o.OutputFn(v) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output_provisioner.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // ProvisionerUIOutput is an implementation of UIOutput that calls a hook 4 | // for the output so that the hooks can handle it. 5 | type ProvisionerUIOutput struct { 6 | Info *InstanceInfo 7 | Type string 8 | Hooks []Hook 9 | } 10 | 11 | func (o *ProvisionerUIOutput) Output(msg string) { 12 | for _, h := range o.Hooks { 13 | h.ProvisionOutput(o.Info, o.Type, msg) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/util.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // Semaphore is a wrapper around a channel to provide 8 | // utility methods to clarify that we are treating the 9 | // channel as a semaphore 10 | type Semaphore chan struct{} 11 | 12 | // NewSemaphore creates a semaphore that allows up 13 | // to a given limit of simultaneous acquisitions 14 | func NewSemaphore(n int) Semaphore { 15 | if n == 0 { 16 | panic("semaphore with limit 0") 17 | } 18 | ch := make(chan struct{}, n) 19 | return Semaphore(ch) 20 | } 21 | 22 | // Acquire is used to acquire an available slot. 23 | // Blocks until available. 24 | func (s Semaphore) Acquire() { 25 | s <- struct{}{} 26 | } 27 | 28 | // TryAcquire is used to do a non-blocking acquire. 29 | // Returns a bool indicating success 30 | func (s Semaphore) TryAcquire() bool { 31 | select { 32 | case s <- struct{}{}: 33 | return true 34 | default: 35 | return false 36 | } 37 | } 38 | 39 | // Release is used to return a slot. Acquire must 40 | // be called as a pre-condition. 41 | func (s Semaphore) Release() { 42 | select { 43 | case <-s: 44 | default: 45 | panic("release without an acquire") 46 | } 47 | } 48 | 49 | // resourceProvider returns the provider name for the given type. 50 | func resourceProvider(t, alias string) string { 51 | if alias != "" { 52 | return alias 53 | } 54 | 55 | idx := strings.IndexRune(t, '_') 56 | if idx == -1 { 57 | return "" 58 | } 59 | 60 | return t[:idx] 61 | } 62 | 63 | // strSliceContains checks if a given string is contained in a slice 64 | // When anybody asks why Go needs generics, here you go. 65 | func strSliceContains(haystack []string, needle string) bool { 66 | for _, s := range haystack { 67 | if s == needle { 68 | return true 69 | } 70 | } 71 | return false 72 | } 73 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/version.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/go-version" 7 | ) 8 | 9 | // The main version number that is being run at the moment. 10 | const Version = "0.8.0" 11 | 12 | // A pre-release marker for the version. If this is "" (empty string) 13 | // then it means that it is a final release. Otherwise, this is a pre-release 14 | // such as "dev" (in development), "beta", "rc1", etc. 15 | const VersionPrerelease = "dev" 16 | 17 | // SemVersion is an instance of version.Version. This has the secondary 18 | // benefit of verifying during tests and init time that our version is a 19 | // proper semantic version, which should always be the case. 20 | var SemVersion = version.Must(version.NewVersion(Version)) 21 | 22 | // VersionHeader is the header name used to send the current terraform version 23 | // in http requests. 24 | const VersionHeader = "Terraform-Version" 25 | 26 | func VersionString() string { 27 | if VersionPrerelease != "" { 28 | return fmt.Sprintf("%s-%s", Version, VersionPrerelease) 29 | } 30 | return Version 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=walkOperation graph_walk_operation.go"; DO NOT EDIT 2 | 3 | package terraform 4 | 5 | import "fmt" 6 | 7 | const _walkOperation_name = "walkInvalidwalkInputwalkApplywalkPlanwalkPlanDestroywalkRefreshwalkValidatewalkDestroywalkImport" 8 | 9 | var _walkOperation_index = [...]uint8{0, 11, 20, 29, 37, 52, 63, 75, 86, 96} 10 | 11 | func (i walkOperation) String() string { 12 | if i >= walkOperation(len(_walkOperation_index)-1) { 13 | return fmt.Sprintf("walkOperation(%d)", i) 14 | } 15 | return _walkOperation_name[_walkOperation_index[i]:_walkOperation_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/yamux/addr.go: -------------------------------------------------------------------------------- 1 | package yamux 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | // hasAddr is used to get the address from the underlying connection 9 | type hasAddr interface { 10 | LocalAddr() net.Addr 11 | RemoteAddr() net.Addr 12 | } 13 | 14 | // yamuxAddr is used when we cannot get the underlying address 15 | type yamuxAddr struct { 16 | Addr string 17 | } 18 | 19 | func (*yamuxAddr) Network() string { 20 | return "yamux" 21 | } 22 | 23 | func (y *yamuxAddr) String() string { 24 | return fmt.Sprintf("yamux:%s", y.Addr) 25 | } 26 | 27 | // Addr is used to get the address of the listener. 28 | func (s *Session) Addr() net.Addr { 29 | return s.LocalAddr() 30 | } 31 | 32 | // LocalAddr is used to get the local address of the 33 | // underlying connection. 34 | func (s *Session) LocalAddr() net.Addr { 35 | addr, ok := s.conn.(hasAddr) 36 | if !ok { 37 | return &yamuxAddr{"local"} 38 | } 39 | return addr.LocalAddr() 40 | } 41 | 42 | // RemoteAddr is used to get the address of remote end 43 | // of the underlying connection 44 | func (s *Session) RemoteAddr() net.Addr { 45 | addr, ok := s.conn.(hasAddr) 46 | if !ok { 47 | return &yamuxAddr{"remote"} 48 | } 49 | return addr.RemoteAddr() 50 | } 51 | 52 | // LocalAddr returns the local address 53 | func (s *Stream) LocalAddr() net.Addr { 54 | return s.session.LocalAddr() 55 | } 56 | 57 | // LocalAddr returns the remote address 58 | func (s *Stream) RemoteAddr() net.Addr { 59 | return s.session.RemoteAddr() 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/yamux/util.go: -------------------------------------------------------------------------------- 1 | package yamux 2 | 3 | // asyncSendErr is used to try an async send of an error 4 | func asyncSendErr(ch chan error, err error) { 5 | if ch == nil { 6 | return 7 | } 8 | select { 9 | case ch <- err: 10 | default: 11 | } 12 | } 13 | 14 | // asyncNotify is used to signal a waiting goroutine 15 | func asyncNotify(ch chan struct{}) { 16 | select { 17 | case ch <- struct{}{}: 18 | default: 19 | } 20 | } 21 | 22 | // min computes the minimum of two values 23 | func min(a, b uint32) uint32 { 24 | if a < b { 25 | return a 26 | } 27 | return b 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 James Saryerwinnie 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 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CMD = jpgo 3 | 4 | help: 5 | @echo "Please use \`make ' where is one of" 6 | @echo " test to run all the tests" 7 | @echo " build to build the library and jp executable" 8 | @echo " generate to run codegen" 9 | 10 | 11 | generate: 12 | go generate ./... 13 | 14 | build: 15 | rm -f $(CMD) 16 | go build ./... 17 | rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... 18 | mv cmd/$(CMD)/$(CMD) . 19 | 20 | test: 21 | go test -v ./... 22 | 23 | check: 24 | go vet ./... 25 | @echo "golint ./..." 26 | @lint=`golint ./...`; \ 27 | lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ 28 | echo "$$lint"; \ 29 | if [ "$$lint" != "" ]; then exit 1; fi 30 | 31 | htmlc: 32 | go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov 33 | 34 | buildfuzz: 35 | go-fuzz-build github.com/jmespath/go-jmespath/fuzz 36 | 37 | fuzz: buildfuzz 38 | go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/corpus 39 | 40 | bench: 41 | go test -bench . -cpuprofile cpu.out 42 | 43 | pprof-cpu: 44 | go tool pprof ./go-jmespath.test ./cpu.out 45 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/README.md: -------------------------------------------------------------------------------- 1 | # go-jmespath - A JMESPath implementation in Go 2 | 3 | [![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) 4 | 5 | 6 | 7 | See http://jmespath.org for more info. 8 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/api.go: -------------------------------------------------------------------------------- 1 | package jmespath 2 | 3 | import "strconv" 4 | 5 | // JmesPath is the epresentation of a compiled JMES path query. A JmesPath is 6 | // safe for concurrent use by multiple goroutines. 7 | type JMESPath struct { 8 | ast ASTNode 9 | intr *treeInterpreter 10 | } 11 | 12 | // Compile parses a JMESPath expression and returns, if successful, a JMESPath 13 | // object that can be used to match against data. 14 | func Compile(expression string) (*JMESPath, error) { 15 | parser := NewParser() 16 | ast, err := parser.Parse(expression) 17 | if err != nil { 18 | return nil, err 19 | } 20 | jmespath := &JMESPath{ast: ast, intr: newInterpreter()} 21 | return jmespath, nil 22 | } 23 | 24 | // MustCompile is like Compile but panics if the expression cannot be parsed. 25 | // It simplifies safe initialization of global variables holding compiled 26 | // JMESPaths. 27 | func MustCompile(expression string) *JMESPath { 28 | jmespath, err := Compile(expression) 29 | if err != nil { 30 | panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error()) 31 | } 32 | return jmespath 33 | } 34 | 35 | // Search evaluates a JMESPath expression against input data and returns the result. 36 | func (jp *JMESPath) Search(data interface{}) (interface{}, error) { 37 | return jp.intr.Execute(jp.ast, data) 38 | } 39 | 40 | // Search evaluates a JMESPath expression against input data and returns the result. 41 | func Search(expression string, data interface{}) (interface{}, error) { 42 | intr := newInterpreter() 43 | parser := NewParser() 44 | ast, err := parser.Parse(expression) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return intr.Execute(ast, data) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/astnodetype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type astNodeType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" 8 | 9 | var _astNodeType_index = [...]uint16{0, 8, 21, 35, 44, 65, 73, 92, 102, 113, 121, 139, 152, 162, 180, 198, 213, 229, 245, 252, 265, 281, 289, 307} 10 | 11 | func (i astNodeType) String() string { 12 | if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { 13 | return fmt.Sprintf("astNodeType(%d)", i) 14 | } 15 | return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/toktype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=tokType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" 8 | 9 | var _tokType_index = [...]uint8{0, 8, 13, 17, 24, 32, 39, 46, 55, 64, 71, 78, 81, 86, 93, 112, 129, 135, 141, 144, 148, 151, 155, 158, 161, 173, 187, 195, 202, 206, 210, 214} 10 | 11 | func (i tokType) String() string { 12 | if i < 0 || i >= tokType(len(_tokType_index)-1) { 13 | return fmt.Sprintf("tokType(%d)", i) 14 | } 15 | return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/README.md: -------------------------------------------------------------------------------- 1 | # copystructure 2 | 3 | copystructure is a Go library for deep copying values in Go. 4 | 5 | This allows you to copy Go values that may contain reference values 6 | such as maps, slices, or pointers, and copy their data as well instead 7 | of just their references. 8 | 9 | ## Installation 10 | 11 | Standard `go get`: 12 | 13 | ``` 14 | $ go get github.com/mitchellh/copystructure 15 | ``` 16 | 17 | ## Usage & Example 18 | 19 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/copystructure). 20 | 21 | The `Copy` function has examples associated with it there. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/copier_time.go: -------------------------------------------------------------------------------- 1 | package copystructure 2 | 3 | import ( 4 | "reflect" 5 | "time" 6 | ) 7 | 8 | func init() { 9 | Copiers[reflect.TypeOf(time.Time{})] = timeCopier 10 | } 11 | 12 | func timeCopier(v interface{}) (interface{}, error) { 13 | // Just... copy it. 14 | return v.(time.Time), nil 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-homedir/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-homedir/README.md: -------------------------------------------------------------------------------- 1 | # go-homedir 2 | 3 | This is a Go library for detecting the user's home directory without 4 | the use of cgo, so the library can be used in cross-compilation environments. 5 | 6 | Usage is incredibly simple, just call `homedir.Dir()` to get the home directory 7 | for a user, and `homedir.Expand()` to expand the `~` in a path to the home 8 | directory. 9 | 10 | **Why not just use `os/user`?** The built-in `os/user` package requires 11 | cgo on Darwin systems. This means that any Go code that uses that package 12 | cannot cross compile. But 99% of the time the use for `os/user` is just to 13 | retrieve the home directory, which we can do for the current user without 14 | cgo. This library does that, enabling cross-compilation. 15 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/README.md: -------------------------------------------------------------------------------- 1 | # mapstructure 2 | 3 | mapstructure is a Go library for decoding generic map values to structures 4 | and vice versa, while providing helpful error handling. 5 | 6 | This library is most useful when decoding values from some data stream (JSON, 7 | Gob, etc.) where you don't _quite_ know the structure of the underlying data 8 | until you read a part of it. You can therefore read a `map[string]interface{}` 9 | and use this library to decode it into the proper underlying native Go 10 | structure. 11 | 12 | ## Installation 13 | 14 | Standard `go get`: 15 | 16 | ``` 17 | $ go get github.com/mitchellh/mapstructure 18 | ``` 19 | 20 | ## Usage & Example 21 | 22 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure). 23 | 24 | The `Decode` function has examples associated with it there. 25 | 26 | ## But Why?! 27 | 28 | Go offers fantastic standard libraries for decoding formats such as JSON. 29 | The standard method is to have a struct pre-created, and populate that struct 30 | from the bytes of the encoded format. This is great, but the problem is if 31 | you have configuration or an encoding that changes slightly depending on 32 | specific fields. For example, consider this JSON: 33 | 34 | ```json 35 | { 36 | "type": "person", 37 | "name": "Mitchell" 38 | } 39 | ``` 40 | 41 | Perhaps we can't populate a specific structure without first reading 42 | the "type" field from the JSON. We could always do two passes over the 43 | decoding of the JSON (reading the "type" first, and the rest later). 44 | However, it is much simpler to just decode this into a `map[string]interface{}` 45 | structure, read the "type" key, then use something like this library 46 | to decode it into the proper structure. 47 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/error.go: -------------------------------------------------------------------------------- 1 | package mapstructure 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Error implements the error interface and can represents multiple 11 | // errors that occur in the course of a single decode. 12 | type Error struct { 13 | Errors []string 14 | } 15 | 16 | func (e *Error) Error() string { 17 | points := make([]string, len(e.Errors)) 18 | for i, err := range e.Errors { 19 | points[i] = fmt.Sprintf("* %s", err) 20 | } 21 | 22 | sort.Strings(points) 23 | return fmt.Sprintf( 24 | "%d error(s) decoding:\n\n%s", 25 | len(e.Errors), strings.Join(points, "\n")) 26 | } 27 | 28 | // WrappedErrors implements the errwrap.Wrapper interface to make this 29 | // return value more useful with the errwrap and go-multierror libraries. 30 | func (e *Error) WrappedErrors() []error { 31 | if e == nil { 32 | return nil 33 | } 34 | 35 | result := make([]error, len(e.Errors)) 36 | for i, e := range e.Errors { 37 | result[i] = errors.New(e) 38 | } 39 | 40 | return result 41 | } 42 | 43 | func appendErrors(errors []string, err error) []string { 44 | switch e := err.(type) { 45 | case *Error: 46 | return append(errors, e.Errors...) 47 | default: 48 | return append(errors, e.Error()) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/README.md: -------------------------------------------------------------------------------- 1 | # reflectwalk 2 | 3 | reflectwalk is a Go library for "walking" a value in Go using reflection, 4 | in the same way a directory tree can be "walked" on the filesystem. Walking 5 | a complex structure can allow you to do manipulations on unknown structures 6 | such as those decoded from JSON. 7 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location.go: -------------------------------------------------------------------------------- 1 | package reflectwalk 2 | 3 | //go:generate stringer -type=Location location.go 4 | 5 | type Location uint 6 | 7 | const ( 8 | None Location = iota 9 | Map 10 | MapKey 11 | MapValue 12 | Slice 13 | SliceElem 14 | Struct 15 | StructField 16 | WalkLoc 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=Location location.go; DO NOT EDIT 2 | 3 | package reflectwalk 4 | 5 | import "fmt" 6 | 7 | const _Location_name = "NoneMapMapKeyMapValueSliceSliceElemStructStructFieldWalkLoc" 8 | 9 | var _Location_index = [...]uint8{0, 4, 7, 13, 21, 26, 35, 41, 52, 59} 10 | 11 | func (i Location) String() string { 12 | if i+1 >= Location(len(_Location_index)) { 13 | return fmt.Sprintf("Location(%d)", i) 14 | } 15 | return _Location_name[_Location_index[i]:_Location_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/pmezard/go-difflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/satori/go.uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2015 by Maxim Bublis 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/scottdware/go-bigip/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Scott Ware 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/scottdware/go-bigip/README.md: -------------------------------------------------------------------------------- 1 | ## go-bigip 2 | [![GoDoc](https://godoc.org/github.com/scottdware/go-bigip?status.svg)](https://godoc.org/github.com/scottdware/go-bigip) [![Travis-CI](https://travis-ci.org/scottdware/go-bigip.svg?branch=master)](https://travis-ci.org/scottdware/go-bigip) 3 | [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/scottdware/go-bigip/master/LICENSE) 4 | 5 | A Go package that interacts with F5 BIG-IP systems using the REST API. 6 | 7 | Some of the tasks you can do are as follows: 8 | 9 | * Get a detailed list of all nodes, pools, vlans, routes, trunks, route domains, self IP's, virtual servers, monitors on the BIG-IP system. 10 | * Create/delete nodes, pools, vlans, routes, trunks, route domains, self IP's, virtual servers, monitors, etc. 11 | * Modify individual settings for all of the above. 12 | * Change the status of nodes and individual pool members (enable/disable). 13 | 14 | > **Note**: You must be on version 11.4+! For the features that deal with internal data groups, you must be running version 11.6+! 15 | 16 | ### Examples & Documentation 17 | Visit the [GoDoc][godoc-go-bigip] page for package documentation and examples. 18 | 19 | Here's a [blog post][blog] that goes a little more in-depth. 20 | 21 | ### Contributors 22 | A very special thanks to the following who have helped contribute to this software, especially: 23 | 24 | * [Adam Burnett](https://github.com/aburnett) 25 | * [Michael D. Ivey](https://github.com/ivey) 26 | 27 | [godoc-go-bigip]: http://godoc.org/github.com/scottdware/go-bigip 28 | [license]: https://github.com/scottdware/go-bigip/blob/master/LICENSE 29 | [blog]: http://sdubs.org/go-big-ip-or-go-home/ 30 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell 2 | 3 | Please consider promoting this project if you find it useful. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 21 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 22 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 4 | } 5 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/doc.go: -------------------------------------------------------------------------------- 1 | // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. 2 | // 3 | // Example Usage 4 | // 5 | // The following is a complete example using assert in a standard test function: 6 | // import ( 7 | // "testing" 8 | // "github.com/stretchr/testify/assert" 9 | // ) 10 | // 11 | // func TestSomething(t *testing.T) { 12 | // 13 | // var a string = "Hello" 14 | // var b string = "Hello" 15 | // 16 | // assert.Equal(t, a, b, "The two words should be the same.") 17 | // 18 | // } 19 | // 20 | // if you assert many times, use the format below: 21 | // 22 | // import ( 23 | // "testing" 24 | // "github.com/stretchr/testify/assert" 25 | // ) 26 | // 27 | // func TestSomething(t *testing.T) { 28 | // assert := assert.New(t) 29 | // 30 | // var a string = "Hello" 31 | // var b string = "Hello" 32 | // 33 | // assert.Equal(a, b, "The two words should be the same.") 34 | // } 35 | // 36 | // Assertions 37 | // 38 | // Assertions allow you to easily write test code, and are global funcs in the `assert` package. 39 | // All assertion functions take, as the first argument, the `*testing.T` object provided by the 40 | // testing framework. This allows the assertion funcs to write the failings and other details to 41 | // the correct place. 42 | // 43 | // Every assertion function also takes an optional string message as the final argument, 44 | // allowing custom error messages to be appended to the message the assertion method outputs. 45 | package assert 46 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl 17 | --------------------------------------------------------------------------------