// CreateApplication creates a new application in Marathon
// 		application:		the structure holding the application configuration
549465
func (r *marathonClient) CreateApplication(application *Application) (*Application, error) {
	result := new(Application)
	if err := r.apiPost(marathonAPIApps, application, result); err != nil {
		return nil, err
	}

	return result, nil
}
1214218
func (s *DeleteApnsVoipChannelInput) SetApplicationId(v string) *DeleteApnsVoipChannelInput {
	s.ApplicationId = &v
	return s
}
563656
func (fw *Firewaller) startApplication(app *firewaller.Application) error {
	exposed, err := app.IsExposed()
	if err != nil {
		return err
	}
	applicationd := &applicationData{
		fw:          fw,
		application: app,
		exposed:     exposed,
		unitds:      make(map[names.UnitTag]*unitData),
	}
	fw.applicationids[app.Tag()] = applicationd

	err = catacomb.Invoke(catacomb.Plan{
		Site: &applicationd.catacomb,
		Work: func() error {
			return applicationd.watchLoop(exposed)
		},
	})
	if err != nil {
		return errors.Trace(err)
	}
	if err := fw.catacomb.Add(applicationd); err != nil {
		return errors.Trace(err)
	}
	return nil
}
1094181
func (_m *Marathon) ListApplications(_a0 url.Values) ([]string, error) {
	ret := _m.Called(_a0)

	var r0 []string
	if rf, ok := ret.Get(0).(func(url.Values) []string); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]string)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(url.Values) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
320894
func (c *FakeApplications) Create(application *v1alpha1.Application) (result *v1alpha1.Application, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(applicationsResource, c.ns, application), &v1alpha1.Application{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.Application), err
}
1085789
func (r *marathonClient) DeleteApplication(name string, force bool) (*DeploymentID, error) {
	path := buildPathWithForceParam(name, force)
	// step: check of the application already exists
	deployID := new(DeploymentID)
	if err := r.apiDelete(path, nil, deployID); err != nil {
		return nil, err
	}

	return deployID, nil
}
992805
func (s *UpdateGcmChannelInput) SetApplicationId(v string) *UpdateGcmChannelInput {
	s.ApplicationId = &v
	return s
}
208397
func (s *GetImportJobInput) SetApplicationId(v string) *GetImportJobInput {
	s.ApplicationId = &v
	return s
}
229281
func (s *GetApplicationOutput) SetApplication(v *ApplicationInfo) *GetApplicationOutput {
	s.Application = v
	return s
}
1012763
func (r *marathonClient) RestartApplication(name string, force bool) (*DeploymentID, error) {
	deployment := new(DeploymentID)
	var options struct{}
	path := buildPathWithForceParam(fmt.Sprintf("%s/restart", name), force)
	if err := r.apiPost(path, &options, deployment); err != nil {
		return nil, err
	}

	return deployment, nil
}
71907
func (s *CampaignResponse) SetApplicationId(v string) *CampaignResponse {
	s.ApplicationId = &v
	return s
}
837089
func (s *DescribeSimulationApplicationInput) SetApplication(v string) *DescribeSimulationApplicationInput {
	s.Application = &v
	return s
}
799186
func (s *DeploymentApplicationConfig) SetApplication(v string) *DeploymentApplicationConfig {
	s.Application = &v
	return s
}
1297400
func (api *API) ApplicationsCreate(apps Applications) (err error) {
	response, err := api.CallWithError("application.create", apps)
	if err != nil {
		return
	}

	result := response.Result.(map[string]interface{})
	applicationids := result["applicationids"].([]interface{})
	for i, id := range applicationids {
		apps[i].ApplicationId = id.(string)
	}
	return
}
422197
func (s *SegmentResponse) SetApplicationId(v string) *SegmentResponse {
	s.ApplicationId = &v
	return s
}
1320947
func (c *Client) CreateApp(req AppCreateRequest) (App, error) {
	var appResp AppResource
	buf := bytes.NewBuffer(nil)
	err := json.NewEncoder(buf).Encode(req)
	if err != nil {
		return App{}, err
	}
	r := c.NewRequestWithBody("POST", "/v2/apps", buf)
	resp, err := c.DoRequest(r)
	if err != nil {
		return App{}, errors.Wrapf(err, "Error creating app %s", req.Name)
	}
	if resp.StatusCode != http.StatusCreated {
		return App{}, errors.Wrapf(err, "Error creating app %s, response code: %d", req.Name, resp.StatusCode)
	}
	resBody, err := ioutil.ReadAll(resp.Body)
	defer resp.Body.Close()
	if err != nil {
		return App{}, errors.Wrapf(err, "Error reading app %s http response body", req.Name)
	}
	err = json.Unmarshal(resBody, &appResp)
	if err != nil {
		return App{}, errors.Wrapf(err, "Error deserializing app %s response", req.Name)
	}
	return c.mergeAppResource(appResp), nil
}
972852
func (api *Client) UpdateApplication(id string, changedData *ApplicationData) error {
	_, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s", api.concatUserPath(applicationsPath), id), nil, changedData)
	return err
}