func (client *Client) GetApplication(guid string) (Application, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetAppRequest,
		URIParams:   Params{"app_guid": guid},
	})
	if err != nil {
		return Application{}, nil, err
	}
	var app Application
	response := cloudcontroller.Response{
		Result: &app,
	}
	err = client.connection.Make(request, &response)
	return app, response.Warnings, err
}
GetApplication returns back an Application.
package ccv2
import (
	"bytes"
	"encoding/json"
	"fmt"
	"time"
	"code.cloudfoundry.org/cli/api/cloudcontroller"
	"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/constant"
	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/internal"
	"code.cloudfoundry.org/cli/types"
)
type ApplicationState string
const (
	ApplicationStarted ApplicationState = "STARTED"
	ApplicationStopped ApplicationState = "STOPPED"
)
type ApplicationPackageState string
const (
	ApplicationPackageStaged  ApplicationPackageState = "STAGED"
	ApplicationPackagePending ApplicationPackageState = "PENDING"
	ApplicationPackageFailed  ApplicationPackageState = "FAILED"
	ApplicationPackageUnknown ApplicationPackageState = "UNKNOWN"
)
type Application struct {
	Buildpack types.FilteredString
	Command types.FilteredString
	DetectedBuildpack types.FilteredString
	DetectedStartCommand types.FilteredString
	DiskQuota types.NullByteSizeInMb
	DockerCredentials DockerCredentials
	DockerImage string
	EnvironmentVariables map[string]string
	GUID string
	HealthCheckTimeout int
	HealthCheckType constant.ApplicationHealthCheckType
	HealthCheckHTTPEndpoint string
	Instances types.NullInt
	Memory types.NullByteSizeInMb
	Name string
	PackageState ApplicationPackageState
	PackageUpdatedAt time.Time
	SpaceGUID string
	StackGUID string
	StagingFailedDescription string
	StagingFailedReason string
	State ApplicationState
}
type DockerCredentials struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}
func (application Application) MarshalJSON() ([]byte, error) {
	ccApp := struct {
		Buildpack               *string                             `json:"buildpack,omitempty"`
		Command                 *string                             `json:"command,omitempty"`
		DiskQuota               *uint64                             `json:"disk_quota,omitempty"`
		DockerCredentials       *DockerCredentials                  `json:"docker_credentials,omitempty"`
		DockerImage             string                              `json:"docker_image,omitempty"`
		EnvironmentVariables    map[string]string                   `json:"environment_json,omitempty"`
		HealthCheckHTTPEndpoint *string                             `json:"health_check_http_endpoint,omitempty"`
		HealthCheckTimeout      int                                 `json:"health_check_timeout,omitempty"`
		HealthCheckType         constant.ApplicationHealthCheckType `json:"health_check_type,omitempty"`
		Instances               *int                                `json:"instances,omitempty"`
		Memory                  *uint64                             `json:"memory,omitempty"`
		Name                    string                              `json:"name,omitempty"`
		SpaceGUID               string                              `json:"space_guid,omitempty"`
		StackGUID               string                              `json:"stack_guid,omitempty"`
		State                   ApplicationState                    `json:"state,omitempty"`
	}{
		DockerImage:          application.DockerImage,
		EnvironmentVariables: application.EnvironmentVariables,
		HealthCheckTimeout:   application.HealthCheckTimeout,
		HealthCheckType:      application.HealthCheckType,
		Name:                 application.Name,
		SpaceGUID:            application.SpaceGUID,
		StackGUID:            application.StackGUID,
		State:                application.State,
	}
	if application.Buildpack.IsSet {
		ccApp.Buildpack = &application.Buildpack.Value
	}
	if application.Command.IsSet {
		ccApp.Command = &application.Command.Value
	}
	if application.DiskQuota.IsSet {
		ccApp.DiskQuota = &application.DiskQuota.Value
	}
	if application.DockerCredentials.Username != "" || application.DockerCredentials.Password != "" {
		ccApp.DockerCredentials = &DockerCredentials{
			Username: application.DockerCredentials.Username,
			Password: application.DockerCredentials.Password,
		}
	}
	if application.Instances.IsSet {
		ccApp.Instances = &application.Instances.Value
	}
	if application.HealthCheckType != "" {
		ccApp.HealthCheckHTTPEndpoint = &application.HealthCheckHTTPEndpoint
	}
	if application.Memory.IsSet {
		ccApp.Memory = &application.Memory.Value
	}
	return json.Marshal(ccApp)
}
func (application *Application) UnmarshalJSON(data []byte) error {
	var ccApp struct {
		Metadata internal.Metadata `json:"metadata"`
		Entity   struct {
			Buildpack            string            `json:"buildpack"`
			Command              string            `json:"command"`
			DetectedBuildpack    string            `json:"detected_buildpack"`
			DetectedStartCommand string            `json:"detected_start_command"`
			DiskQuota            *uint64           `json:"disk_quota"`
			DockerImage          string            `json:"docker_image"`
			DockerCredentials    DockerCredentials `json:"docker_credentials"`
			EnvironmentVariables     map[string]interface{} `json:"environment_json"`
			HealthCheckHTTPEndpoint  string                 `json:"health_check_http_endpoint"`
			HealthCheckTimeout       int                    `json:"health_check_timeout"`
			HealthCheckType          string                 `json:"health_check_type"`
			Instances                json.Number            `json:"instances"`
			Memory                   *uint64                `json:"memory"`
			Name                     string                 `json:"name"`
			PackageState             string                 `json:"package_state"`
			PackageUpdatedAt         *time.Time             `json:"package_updated_at"`
			StackGUID                string                 `json:"stack_guid"`
			StagingFailedDescription string                 `json:"staging_failed_description"`
			StagingFailedReason      string                 `json:"staging_failed_reason"`
			State                    string                 `json:"state"`
		} `json:"entity"`
	}
	decoder := json.NewDecoder(bytes.NewBuffer(data))
	decoder.UseNumber()
	err := decoder.Decode(&ccApp)
	if err != nil {
		return err
	}
	application.Buildpack.ParseValue(ccApp.Entity.Buildpack)
	application.Command.ParseValue(ccApp.Entity.Command)
	application.DetectedBuildpack.ParseValue(ccApp.Entity.DetectedBuildpack)
	application.DetectedStartCommand.ParseValue(ccApp.Entity.DetectedStartCommand)
	application.DiskQuota.ParseUint64Value(ccApp.Entity.DiskQuota)
	application.DockerCredentials = ccApp.Entity.DockerCredentials
	application.DockerImage = ccApp.Entity.DockerImage
	application.GUID = ccApp.Metadata.GUID
	application.HealthCheckHTTPEndpoint = ccApp.Entity.HealthCheckHTTPEndpoint
	application.HealthCheckTimeout = ccApp.Entity.HealthCheckTimeout
	application.HealthCheckType = constant.ApplicationHealthCheckType(ccApp.Entity.HealthCheckType)
	application.Memory.ParseUint64Value(ccApp.Entity.Memory)
	application.Name = ccApp.Entity.Name
	application.PackageState = ApplicationPackageState(ccApp.Entity.PackageState)
	application.StackGUID = ccApp.Entity.StackGUID
	application.StagingFailedDescription = ccApp.Entity.StagingFailedDescription
	application.StagingFailedReason = ccApp.Entity.StagingFailedReason
	application.State = ApplicationState(ccApp.Entity.State)
	if len(ccApp.Entity.EnvironmentVariables) > 0 {
		envVariableValues := map[string]string{}
		for key, value := range ccApp.Entity.EnvironmentVariables {
			envVariableValues[key] = fmt.Sprint(value)
		}
		application.EnvironmentVariables = envVariableValues
	}
	err = application.Instances.ParseStringValue(ccApp.Entity.Instances.String())
	if err != nil {
		return err
	}
	if ccApp.Entity.PackageUpdatedAt != nil {
		application.PackageUpdatedAt = *ccApp.Entity.PackageUpdatedAt
	}
	return nil
}
func (client *Client) CreateApplication(app Application) (Application, Warnings, error) {
	body, err := json.Marshal(app)
	if err != nil {
		return Application{}, nil, err
	}
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.PostAppRequest,
		Body:        bytes.NewReader(body),
	})
	if err != nil {
		return Application{}, nil, err
	}
	var updatedApp Application
	response := cloudcontroller.Response{
		Result: &updatedApp,
	}
	err = client.connection.Make(request, &response)
	return updatedApp, response.Warnings, err
}