github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccv3/environment_variables.go (about) 1 package ccv3 2 3 import ( 4 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" 5 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" 6 "code.cloudfoundry.org/cli/resources" 7 ) 8 9 // EnvironmentVariables represents the environment variables that can be set on 10 // an application by the user. 11 12 // GetEnvironmentVariableGroup gets the values of a particular environment variable group. 13 func (client *Client) GetEnvironmentVariableGroup(group constant.EnvironmentVariableGroupName) (resources.EnvironmentVariables, Warnings, error) { 14 var responseBody resources.EnvironmentVariables 15 16 _, warnings, err := client.MakeRequest(RequestParams{ 17 RequestName: internal.GetEnvironmentVariableGroupRequest, 18 URIParams: internal.Params{"group_name": string(group)}, 19 ResponseBody: &responseBody, 20 }) 21 22 return responseBody, warnings, err 23 } 24 25 // UpdateApplicationEnvironmentVariables adds/updates the user provided 26 // environment variables on an application. A restart is required for changes 27 // to take effect. 28 func (client *Client) UpdateApplicationEnvironmentVariables(appGUID string, envVars resources.EnvironmentVariables) (resources.EnvironmentVariables, Warnings, error) { 29 var responseBody resources.EnvironmentVariables 30 31 _, warnings, err := client.MakeRequest(RequestParams{ 32 RequestName: internal.PatchApplicationEnvironmentVariablesRequest, 33 URIParams: internal.Params{"app_guid": appGUID}, 34 RequestBody: envVars, 35 ResponseBody: &responseBody, 36 }) 37 38 return responseBody, warnings, err 39 } 40 41 func (client *Client) UpdateEnvironmentVariableGroup(group constant.EnvironmentVariableGroupName, envVars resources.EnvironmentVariables) (resources.EnvironmentVariables, Warnings, error) { 42 var responseBody resources.EnvironmentVariables 43 44 _, warnings, err := client.MakeRequest(RequestParams{ 45 RequestName: internal.PatchEnvironmentVariableGroupRequest, 46 URIParams: internal.Params{"group_name": string(group)}, 47 RequestBody: envVars, 48 ResponseBody: &responseBody, 49 }) 50 51 return responseBody, warnings, err 52 }