Refactor functions into methods

GetRRFileContents and GetFileContents are better suited as
methods of Environment and Template repectively.
diff --git a/openstack/orchestration/v1/stacks/environment.go b/openstack/orchestration/v1/stacks/environment.go
index 1fc01e0..94fda6c 100644
--- a/openstack/orchestration/v1/stacks/environment.go
+++ b/openstack/orchestration/v1/stacks/environment.go
@@ -35,7 +35,7 @@
 // Parse environment file to resolve the URL's of the resources. This is done by
 // reading from the `Resource Registry` section, which is why the function is
 // named GetRRFileContents.
-func GetRRFileContents(e *Environment, ignoreIf igFunc) error {
+func (e *Environment) GetRRFileContents(ignoreIf igFunc) error {
 	// initialize environment if empty
 	if e.Files == nil {
 		e.Files = make(map[string]string)
@@ -71,10 +71,13 @@
 		tempTemplate.baseURL = baseURL
 		tempTemplate.client = e.client
 
-		if err = GetFileContents(tempTemplate, rr, ignoreIf, false); err != nil {
+		// Fetch the contents of remote resource URL's
+		if err = tempTemplate.GetFileContents(rr, ignoreIf, false); err != nil {
 			return err
 		}
-		// check the `resources` section (if it exists) for more URLs
+		// check the `resources` section (if it exists) for more URL's. Note that
+		// the previous call to GetFileContents was (deliberately) not recursive
+		// as we want more control over where to look for URL's
 		if val, ok := rr_map["resources"]; ok {
 			switch val.(type) {
 			// process further only if the contents are a map
@@ -98,7 +101,7 @@
 							resourceBaseURL = baseURL
 						}
 						tempTemplate.baseURL = resourceBaseURL
-						if err := GetFileContents(tempTemplate, v, ignoreIf, false); err != nil {
+						if err := tempTemplate.GetFileContents(v, ignoreIf, false); err != nil {
 							return err
 						}
 					}
diff --git a/openstack/orchestration/v1/stacks/environment_test.go b/openstack/orchestration/v1/stacks/environment_test.go
index 7d5aaec..5a02d7a 100644
--- a/openstack/orchestration/v1/stacks/environment_test.go
+++ b/openstack/orchestration/v1/stacks/environment_test.go
@@ -161,7 +161,7 @@
 
 	err = env.Parse()
 	th.AssertNoErr(t, err)
-	err = GetRRFileContents(env, ignoreIfEnvironment)
+	err = env.GetRRFileContents(ignoreIfEnvironment)
 	th.AssertNoErr(t, err)
 	expected_env_files_content := "\nheat_template_version: 2013-05-23\n\ndescription:\n  Heat WordPress template to support F18, using only Heat OpenStack-native\n  resource types, and without the requirement for heat-cfntools in the image.\n  WordPress is web software you can use to create a beautiful website or blog.\n  This template installs a single-instance WordPress deployment using a local\n  MySQL database to store the data.\n\nparameters:\n\n  key_name:\n    type: string\n    description : Name of a KeyPair to enable SSH access to the instance\n\nresources:\n  wordpress_instance:\n    type: OS::Nova::Server\n    properties:\n      image: { get_param: image_id }\n      flavor: { get_param: instance_type }\n      key_name: { get_param: key_name }"
 	expected_db_files_content := "\nheat_template_version: 2014-10-16\n\ndescription:\n  Test template for Trove resource capabilities\n\nparameters:\n  db_pass:\n    type: string\n    hidden: true\n    description: Database access password\n    default: secrete\n\nresources:\n\nservice_db:\n  type: OS::Trove::Instance\n  properties:\n    name: trove_test_db\n    datastore_type: mariadb\n    flavor: 1GB Instance\n    size: 10\n    databases:\n    - name: test_data\n    users:\n    - name: kitchen_sink\n      password: { get_param: db_pass }\n      databases: [ test_data ]"
diff --git a/openstack/orchestration/v1/stacks/requests.go b/openstack/orchestration/v1/stacks/requests.go
index 9859d4d..230525c 100644
--- a/openstack/orchestration/v1/stacks/requests.go
+++ b/openstack/orchestration/v1/stacks/requests.go
@@ -100,7 +100,7 @@
 			return nil, err
 		}
 
-		if err := GetFileContents(opts.TemplateOpts, opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
+		if err := opts.TemplateOpts.GetFileContents(opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
 			return nil, err
 		}
 		opts.TemplateOpts.FixFileRefs()
@@ -118,7 +118,7 @@
 		if err := opts.EnvironmentOpts.Parse(); err != nil {
 			return nil, err
 		}
-		if err := GetRRFileContents(opts.EnvironmentOpts, ignoreIfEnvironment); err != nil {
+		if err := opts.EnvironmentOpts.GetRRFileContents(ignoreIfEnvironment); err != nil {
 			return nil, err
 		}
 		opts.EnvironmentOpts.FixFileRefs()
@@ -250,7 +250,7 @@
 			return nil, err
 		}
 
-		if err := GetFileContents(opts.TemplateOpts, opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
+		if err := opts.TemplateOpts.GetFileContents(opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
 			return nil, err
 		}
 		opts.TemplateOpts.FixFileRefs()
@@ -273,7 +273,7 @@
 		if err := opts.EnvironmentOpts.Parse(); err != nil {
 			return nil, err
 		}
-		if err := GetRRFileContents(opts.EnvironmentOpts, ignoreIfEnvironment); err != nil {
+		if err := opts.EnvironmentOpts.GetRRFileContents(ignoreIfEnvironment); err != nil {
 			return nil, err
 		}
 		opts.EnvironmentOpts.FixFileRefs()
@@ -461,7 +461,7 @@
 			return nil, err
 		}
 
-		if err := GetFileContents(opts.TemplateOpts, opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
+		if err := opts.TemplateOpts.GetFileContents(opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
 			return nil, err
 		}
 		opts.TemplateOpts.FixFileRefs()
@@ -476,7 +476,7 @@
 		if err := opts.EnvironmentOpts.Parse(); err != nil {
 			return nil, err
 		}
-		if err := GetRRFileContents(opts.EnvironmentOpts, ignoreIfEnvironment); err != nil {
+		if err := opts.EnvironmentOpts.GetRRFileContents(ignoreIfEnvironment); err != nil {
 			return nil, err
 		}
 		opts.EnvironmentOpts.FixFileRefs()
@@ -607,7 +607,7 @@
 			return nil, err
 		}
 
-		if err := GetFileContents(opts.TemplateOpts, opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
+		if err := opts.TemplateOpts.GetFileContents(opts.TemplateOpts.Parsed, ignoreIfTemplate, true); err != nil {
 			return nil, err
 		}
 		opts.TemplateOpts.FixFileRefs()
@@ -625,7 +625,7 @@
 		if err := opts.EnvironmentOpts.Parse(); err != nil {
 			return nil, err
 		}
-		if err := GetRRFileContents(opts.EnvironmentOpts, ignoreIfEnvironment); err != nil {
+		if err := opts.EnvironmentOpts.GetRRFileContents(ignoreIfEnvironment); err != nil {
 			return nil, err
 		}
 		opts.EnvironmentOpts.FixFileRefs()
diff --git a/openstack/orchestration/v1/stacks/template.go b/openstack/orchestration/v1/stacks/template.go
index 912546b..b54fe52 100644
--- a/openstack/orchestration/v1/stacks/template.go
+++ b/openstack/orchestration/v1/stacks/template.go
@@ -38,7 +38,7 @@
 // parameter of the template structure. This is the only way that a user can
 // use child templates that are located in their filesystem; urls located on the
 // web (e.g. on github or swift) can be fetched directly by Heat engine.
-func GetFileContents(t *Template, te interface{}, ignoreIf igFunc, recurse bool) error {
+func (t *Template) GetFileContents(te interface{}, ignoreIf igFunc, recurse bool) error {
 	// initialize template if empty
 	if t.Files == nil {
 		t.Files = make(map[string]string)
@@ -57,7 +57,7 @@
 			value, ok := v.(string)
 			if !ok {
 				// if the value is not a string, recursively parse that value
-				if err := GetFileContents(t, v, ignoreIf, recurse); err != nil {
+				if err := t.GetFileContents(v, ignoreIf, recurse); err != nil {
 					return err
 				}
 			} else if !ignoreIf(k, value) {
@@ -87,7 +87,7 @@
 				// required if the child template itself contains references to
 				// other templates
 				if recurse {
-					if err := GetFileContents(childTemplate, childTemplate.Parsed, ignoreIf, recurse); err != nil {
+					if err := childTemplate.GetFileContents(childTemplate.Parsed, ignoreIf, recurse); err != nil {
 						return err
 					}
 				}
@@ -103,7 +103,7 @@
 	case []interface{}:
 		te_slice := te.([]interface{})
 		for i := range te_slice {
-			if err := GetFileContents(t, te_slice[i], ignoreIf, recurse); err != nil {
+			if err := t.GetFileContents(te_slice[i], ignoreIf, recurse); err != nil {
 				return err
 			}
 		}
diff --git a/openstack/orchestration/v1/stacks/template_test.go b/openstack/orchestration/v1/stacks/template_test.go
index 23e2cc9..c944e9a 100644
--- a/openstack/orchestration/v1/stacks/template_test.go
+++ b/openstack/orchestration/v1/stacks/template_test.go
@@ -114,7 +114,7 @@
 
 	err = te.Parse()
 	th.AssertNoErr(t, err)
-	err = GetFileContents(te, te.Parsed, ignoreIfTemplate, true)
+	err = te.GetFileContents(te.Parsed, ignoreIfTemplate, true)
 	th.AssertNoErr(t, err)
 	expected_files := map[string]string{
 		"my_nova.yaml": `heat_template_version: 2014-10-16