//Patch an Application.
349317
func Patch(cmd *cli.Cmd) {
	uuid := cmd.String(cli.StringArg{
		Name:      "UUID",
		Desc:      "Application UUID",
		HideValue: true,
	})

	image := cmd.String(cli.StringOpt{
		Name:      "image_url",
		Desc:      "Image URL",
		HideValue: true,
	})

	name := cmd.String(cli.StringOpt{
		Name:      "name",
		Desc:      "Application Name",
		HideValue: true,
	})

	envFile := cmd.String(cli.StringOpt{
		Name:      "env_file",
		Desc:      "Environment variables file",
		HideValue: true,
	})

	enVars := cmd.Strings(cli.StringsOpt{
		Name:      "e env",
		Desc:      "Environment variable (i.e. MYSQL_PASSWORD=complexpassword",
		HideValue: true,
	})

	rules := cmd.Strings(cli.StringsOpt{
		Name:      "r rule",
		Desc:      "Application Deployment rules",
		HideValue: true,
	})

	labels := cmd.Strings(cli.StringsOpt{
		Name:      "l label",
		Desc:      "Label associated with the aplication",
		HideValue: true,
	})

	meta := cmd.String(cli.StringOpt{
		Name:      "m metadata",
		Desc:      "Metadata associated with the application being created. Must be JSON formatted.",
		HideValue: true,
	})

	cmd.Action = func() {
		originalApp := &application.Application{
			UUID: *uuid,
		}

		originalApp, _, errs := originalApp.Show()

		if len(errs) != 0 {
			log.Fatalf("Unable to retrieve application: %s", errs)
		}

		patchedApp := *originalApp

		if *envFile != "" || len(*enVars) > 0 {
			patchedApp.Environment = transformEnvironment(envFile, enVars)
		} else if *image != "" {
			patchedApp.ImageURL = *image
		} else if *meta != "" || len(*labels) > 0 {
			patchedApp.Metadata = metaData(*meta, *labels)
		} else if *name != "" {
			patchedApp.Name = *name
		} else if len(*rules) > 0 {
			patchedApp.Rules = transformRules(rules)
		}

		pApp, resp, errs := originalApp.Patch(&patchedApp)

		if len(errs) > 0 {
			log.Fatalf("Could not patch application: %s", errs[0])
		}

		if resp.StatusCode != 200 {
			log.Fatalf("Could not patch application: %s", resp.Status)
		}

		printAppDetail(pApp)
	}
}
530547
func (p *PullRequestsService) Patch() (patch io.ReadCloser, result *Result) {
	return p.client.getBody(p.URL, patchMediaType)
}
438202
func (api *APIBuilder) Patch(relativePath string, handlers ...context.Handler) *Route {
	return api.Handle(http.MethodPatch, relativePath, handlers...)
}
1299992
func (c *FakeApplications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Application, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(applicationsResource, c.ns, name, data, subresources...), &v1alpha1.Application{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.Application), err
}
481211
func (c *FakeBundles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *smithv1.Bundle, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(bundlesResource, c.ns, name, pt, data, subresources...), &smithv1.Bundle{})

	if obj == nil {
		return nil, err
	}
	return obj.(*smithv1.Bundle), err
}
403266
func (c *FakePodSecurityPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PodSecurityPolicy, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootPatchSubresourceAction(podsecuritypoliciesResource, name, pt, data, subresources...), &v1beta1.PodSecurityPolicy{})
	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta1.PodSecurityPolicy), err
}
151378
func (r *AppService) Patch(id string, appupdatereq *AppUpdateReq) *AppPatchCall {
	c := &AppPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.id = id
	c.appupdatereq = appupdatereq
	return c
}
59137
func (gr *GoReq) Patch(targetURL string) *GoReq {
	//gr.Reset()
	gr.Method = PATCH
	gr.URL = targetURL
	gr.Errors = nil
	return gr
}
944100
func (r *Route) Patch(fn http.HandlerFunc) *Route {
	return r.Method(http.MethodPatch, fn)
}
55128
func (s *Sling) Patch(pathURL string) *Sling {
	s.method = "PATCH"
	return s.Path(pathURL)
}
1327811
func (c *RESTClient) Patch(pt types.PatchType) *Request {
	return c.Verb("PATCH").SetHeader("Content-Type", string(pt))
}
234220
func (c *FakeControllerRevisions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.ControllerRevision, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(controllerrevisionsResource, c.ns, name, pt, data, subresources...), &v1beta2.ControllerRevision{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta2.ControllerRevision), err
}
565199
func (g *routeGroup) Patch(path string, h http.HandlerFunc) {
	g.handle(http.MethodPatch, path, h)
}
171639
func (r *RestClient) Patch(path string, body, v interface{}, options ...RequestOption) error {
	return r.Do("PATCH", path, body, v, options...)
}
96275
func (g *Group) Patch(path string, h HandlerFunc, opts ...HandlerOption) {
	g.add(path, h, opts, http.MethodPatch)
}
477370
func (c *FakeNetworkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.NetworkPolicy, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(networkpoliciesResource, c.ns, name, pt, data, subresources...), &v1beta1.NetworkPolicy{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta1.NetworkPolicy), err
}
514014
func (r *Route) Patch(handlers ...Handler) *Route {
	return r.group.add("PATCH", r.path, handlers)
}