github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/api/cloudcontroller/ccv3/environment.go (about) 1 package ccv3 2 3 import ( 4 "code.cloudfoundry.org/cli/api/cloudcontroller" 5 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" 6 ) 7 8 // Environment variables that will be provided to an app at runtime. It will 9 // include environment variables for Environment Variable Groups and Service 10 // Bindings. 11 type Environment struct { 12 // Application contains basic application settings set by the user and CF 13 // instance. 14 Application map[string]interface{} `json:"application_env_json"` 15 // EnvironmentVariables are user provided environment variables. 16 EnvironmentVariables map[string]interface{} `json:"environment_variables"` 17 //Running is the set of default environment variables available to running 18 //apps. 19 Running map[string]interface{} `json:"running_env_json"` 20 //Staging is the set of default environment variables available during 21 //staging. 22 Staging map[string]interface{} `json:"staging_env_json"` 23 // System contains information about bound services for the application. AKA 24 // VCAP_SERVICES. 25 System map[string]interface{} `json:"system_env_json"` 26 } 27 28 // GetApplicationEnvironment fetches all the environment variables on 29 // an application by groups. 30 func (client *Client) GetApplicationEnvironment(appGUID string) (Environment, Warnings, error) { 31 request, err := client.newHTTPRequest(requestOptions{ 32 URIParams: internal.Params{"app_guid": appGUID}, 33 RequestName: internal.GetApplicationEnvRequest, 34 }) 35 if err != nil { 36 return Environment{}, nil, err 37 } 38 39 var responseEnvVars Environment 40 response := cloudcontroller.Response{ 41 DecodeJSONResponseInto: &responseEnvVars, 42 } 43 err = client.connection.Make(request, &response) 44 return responseEnvVars, response.Warnings, err 45 }