// Currently only supports Deployments.
543545
func defaultObjectPauser(obj runtime.Object) ([]byte, error) {
	switch obj := obj.(type) {
	case *extensionsv1beta1.Deployment:
		if obj.Spec.Paused {
			return nil, errors.New("is already paused")
		}
		obj.Spec.Paused = true
		return runtime.Encode(scheme.Codecs.LegacyCodec(extensionsv1beta1.SchemeGroupVersion), obj)

	case *appsv1.Deployment:
		if obj.Spec.Paused {
			return nil, errors.New("is already paused")
		}
		obj.Spec.Paused = true
		return runtime.Encode(scheme.Codecs.LegacyCodec(appsv1.SchemeGroupVersion), obj)

	case *appsv1beta2.Deployment:
		if obj.Spec.Paused {
			return nil, errors.New("is already paused")
		}
		obj.Spec.Paused = true
		return runtime.Encode(scheme.Codecs.LegacyCodec(appsv1beta2.SchemeGroupVersion), obj)

	case *appsv1beta1.Deployment:
		if obj.Spec.Paused {
			return nil, errors.New("is already paused")
		}
		obj.Spec.Paused = true
		return runtime.Encode(scheme.Codecs.LegacyCodec(appsv1beta1.SchemeGroupVersion), obj)

	default:
		return nil, fmt.Errorf("pausing is not supported")
	}
}
99398
func (env *maasEnviron) deploymentStatus(ctx context.ProviderCallContext, ids ...instance.Id) (map[string]string, error) {
	nodesAPI := env.getMAASClient().GetSubObject("nodes")
	result, err := DeploymentStatusCall(nodesAPI, ids...)
	if err != nil {
		if err, ok := errors.Cause(err).(gomaasapi.ServerError); ok && err.StatusCode == http.StatusBadRequest {
			return nil, errors.NewNotImplemented(err, "deployment status")
		}
		common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
		return nil, errors.Trace(err)
	}
	resultMap, err := result.GetMap()
	if err != nil {
		return nil, errors.Trace(err)
	}
	statusValues := make(map[string]string)
	for systemId, jsonValue := range resultMap {
		status, err := jsonValue.GetString()
		if err != nil {
			return nil, errors.Trace(err)
		}
		statusValues[systemId] = status
	}
	return statusValues, nil
}
342789
func Convert_v1_DeploymentConfigRollback_To_apps_DeploymentConfigRollback(in *v1.DeploymentConfigRollback, out *apps.DeploymentConfigRollback, s conversion.Scope) error {
	return autoConvert_v1_DeploymentConfigRollback_To_apps_DeploymentConfigRollback(in, out, s)
}
466225
func (c *Client) DeploymentList(appID string) ([]*ct.Deployment, error) {
	var deployments []*ct.Deployment
	return deployments, c.Get(fmt.Sprintf("/apps/%s/deployments", appID), &deployments)
}
3794
func DeployResources(
	applicationID string,
	chID charmstore.CharmID,
	csMac *macaroon.Macaroon,
	filesAndRevisions map[string]string,
	resources map[string]charmresource.Meta,
	conn base.APICallCloser,
) (ids map[string]string, err error) {

	if len(filesAndRevisions)+len(resources) == 0 {
		// Nothing to upload.
		return nil, nil
	}

	client, err := NewAPIClient(conn)
	if err != nil {
		return nil, errors.Trace(err)
	}

	filenames := make(map[string]string)
	revisions := make(map[string]int)
	for name, val := range filesAndRevisions {
		rev, err := strconv.Atoi(val)
		if err != nil {
			filenames[name] = val
		} else {
			revisions[name] = rev
		}
	}

	ids, err = resourcecmd.DeployResources(resourcecmd.DeployResourcesArgs{
		ApplicationID:      applicationID,
		CharmID:            chID,
		CharmStoreMacaroon: csMac,
		ResourceValues:     filenames,
		Revisions:          revisions,
		ResourcesMeta:      resources,
		Client:             &deployClient{client},
	})
	if err != nil {
		return nil, errors.Trace(err)
	}
	return ids, nil
}
1085793
func Convert_apps_DeploymentRequest_To_v1_DeploymentRequest(in *apps.DeploymentRequest, out *v1.DeploymentRequest, s conversion.Scope) error {
	return autoConvert_apps_DeploymentRequest_To_v1_DeploymentRequest(in, out, s)
}
1111819
func Convert_apps_DeploymentStatus_To_v1_DeploymentStatus(in *apps.DeploymentStatus, out *v1.DeploymentStatus, s conversion.Scope) error {
	return autoConvert_apps_DeploymentStatus_To_v1_DeploymentStatus(in, out, s)
}
1132614
func Convert_apps_DeploymentConfig_To_v1_DeploymentConfig(in *apps.DeploymentConfig, out *v1.DeploymentConfig, s conversion.Scope) error {
	return autoConvert_apps_DeploymentConfig_To_v1_DeploymentConfig(in, out, s)
}
626867
func (c *CoreScheduler) deploymentReap(deployments []string) error {
	// Call to the leader to issue the reap
	for _, req := range c.partitionDeploymentReap(deployments) {
		var resp structs.GenericResponse
		if err := c.srv.RPC("Deployment.Reap", req, &resp); err != nil {
			c.logger.Error("deployment reap failed", "error", err)
			return err
		}
	}

	return nil
}
406547
func (r *StateRestore) DeploymentRestore(deployment *structs.Deployment) error {
	if err := r.txn.Insert("deployment", deployment); err != nil {
		return fmt.Errorf("deployment insert failed: %v", err)
	}
	return nil
}
153597
func Deploy(cmd *cli.Cmd) {
	uuid := cmd.String(cli.StringArg{
		Name:      "UUID",
		Desc:      "Application UUID",
		HideValue: true,
	})

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

		application, resp, errs := app.Show() // TODO remove this duplication of application.Show() logic

		if errs != nil {
			log.Fatalf("Could not retrieve deployment token: %s", errs)
		}

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

		application, resp, errs = application.Deploy()

		if errs != nil {
			log.Fatalf("Could not deploy application: %s", errs)
		}

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

		fmt.Printf("Deploying application %s\n", application.UUID)
	}

}
714035
func (ar *allocRunner) persistDeploymentStatus(ds *structs.AllocDeploymentStatus) {
	if err := ar.stateDB.PutDeploymentStatus(ar.id, ds); err != nil {
		// While any persistence errors are very bad, the worst case
		// scenario for failing to persist deployment status is that if
		// the agent is restarted it will monitor the deployment status
		// again. This could cause a deployment's status to change when
		// that shouldn't happen. However, allowing that seems better
		// than failing the entire allocation.
		ar.logger.Error("error storing deployment status", "error", err)
	}
}
653213
func (e *Empire) Deploy(ctx context.Context, opts DeployOpts) (*Release, error) {
	if err := opts.Validate(e); err != nil {
		return nil, err
	}

	r, err := e.deployer.Deploy(ctx, opts)
	if err != nil {
		return r, err
	}

	event := opts.Event()
	event.Release = r.Version
	event.Environment = e.Environment
	// Deals with new app creation on first deploy
	if event.App == "" && r.App != nil {
		event.App = r.App.Name
		event.app = r.App
	}

	return r, e.PublishEvent(event)
}
23733
func (_m *FacadeInterface) DeployTemplateActive() ([]map[string]string, error) {
	ret := _m.Called()

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

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

	return r0, r1
}
323173
func (n *nomadFSM) applyDeploymentPromotion(buf []byte, index uint64) interface{} {
	defer metrics.MeasureSince([]string{"nomad", "fsm", "apply_deployment_promotion"}, time.Now())
	var req structs.ApplyDeploymentPromoteRequest
	if err := structs.Decode(buf, &req); err != nil {
		panic(fmt.Errorf("failed to decode request: %v", err))
	}

	if err := n.state.UpdateDeploymentPromotion(index, &req); err != nil {
		n.logger.Error("UpsertDeploymentPromotion failed", "error", err)
		return err
	}

	n.handleUpsertedEval(req.Eval)
	return nil
}
1031519
func (m *MockAppsV1Interface) Deployments(arg0 string) v11.DeploymentInterface {
	ret := m.ctrl.Call(m, "Deployments", arg0)
	ret0, _ := ret[0].(v11.DeploymentInterface)
	return ret0
}
239718
func Convert_v1beta2_DeploymentCondition_To_apps_DeploymentCondition(in *v1beta2.DeploymentCondition, out *apps.DeploymentCondition, s conversion.Scope) error {
	return autoConvert_v1beta2_DeploymentCondition_To_apps_DeploymentCondition(in, out, s)
}