// SetSpec sets the Spec field's value.
328029
func (s *CreateVirtualServiceInput) SetSpec(v *VirtualServiceSpec) *CreateVirtualServiceInput {
	s.Spec = v
	return s
}
777091
func (s *HlsGroupSettings) SetCodecSpecification(v string) *HlsGroupSettings {
	s.CodecSpecification = &v
	return s
}
438463
func (s *UpdateVirtualServiceInput) SetSpec(v *VirtualServiceSpec) *UpdateVirtualServiceInput {
	s.Spec = v
	return s
}
646423
func (s *CreateTableInput) SetSSESpecification(v *SSESpecification) *CreateTableInput {
	s.SSESpecification = v
	return s
}
880073
func (s *CreateCertificateFromCsrOutput) SetCertificatePem(v string) *CreateCertificateFromCsrOutput {
	s.CertificatePem = &v
	return s
}
962837
func (s *CACertificateDescription) SetCertificatePem(v string) *CACertificateDescription {
	s.CertificatePem = &v
	return s
}
1215435
func (s *JobManifest) SetSpec(v *JobManifestSpec) *JobManifest {
	s.Spec = v
	return s
}
504552
func (m *CAASModel) SetPodSpec(appTag names.ApplicationTag, spec string) error {
	buildTxn := func(attempt int) ([]txn.Op, error) {
		var prereqOps []txn.Op
		app, err := m.State().Application(appTag.Id())
		if err != nil {
			return nil, errors.Trace(err)
		}
		if app.Life() != Alive {
			return nil, errors.Errorf("application %s not alive", app.String())
		}
		prereqOps = append(prereqOps, txn.Op{
			C:      applicationsC,
			Id:     app.doc.DocID,
			Assert: isAliveDoc,
		})

		op := txn.Op{
			C:  podSpecsC,
			Id: applicationGlobalKey(appTag.Id()),
		}
		existing, err := m.PodSpec(appTag)
		if err == nil {
			if existing == spec {
				return nil, jujutxn.ErrNoOperations
			}
			op.Assert = txn.DocExists
			op.Update = bson.D{{"$set", bson.D{{"spec", spec}}}}
		} else if errors.IsNotFound(err) {
			op.Assert = txn.DocMissing
			op.Insert = containerSpecDoc{Spec: spec}
		} else {
			return nil, err
		}
		return append(prereqOps, op), nil
	}
	return m.mb.db().Run(buildTxn)
}
1331603
func (daemon *Daemon) setWindowsCredentialSpec(c *container.Container, s *specs.Spec) error {
	if c.HostConfig == nil || c.HostConfig.SecurityOpt == nil {
		return nil
	}

	// TODO (jrouge/wk8): if provided with several security options, we silently ignore
	// all but the last one (provided they're all valid, otherwise we do return an error);
	// this doesn't seem like a great idea?
	credentialSpec := ""

	for _, secOpt := range c.HostConfig.SecurityOpt {
		optSplits := strings.SplitN(secOpt, "=", 2)
		if len(optSplits) != 2 {
			return errdefs.InvalidParameter(fmt.Errorf("invalid security option: no equals sign in supplied value %s", secOpt))
		}
		if !strings.EqualFold(optSplits[0], "credentialspec") {
			return errdefs.InvalidParameter(fmt.Errorf("security option not supported: %s", optSplits[0]))
		}

		credSpecSplits := strings.SplitN(optSplits[1], "://", 2)
		if len(credSpecSplits) != 2 || credSpecSplits[1] == "" {
			return errInvalidCredentialSpecSecOpt
		}
		value := credSpecSplits[1]

		var err error
		switch strings.ToLower(credSpecSplits[0]) {
		case "file":
			if credentialSpec, err = readCredentialSpecFile(c.ID, daemon.root, filepath.Clean(value)); err != nil {
				return errdefs.InvalidParameter(err)
			}
		case "registry":
			if credentialSpec, err = readCredentialSpecRegistry(c.ID, value); err != nil {
				return errdefs.InvalidParameter(err)
			}
		case "config":
			// if the container does not have a DependencyStore, then it
			// isn't swarmkit managed. In order to avoid creating any
			// impression that `config://` is a valid API, return the same
			// error as if you'd passed any other random word.
			if c.DependencyStore == nil {
				return errInvalidCredentialSpecSecOpt
			}

			csConfig, err := c.DependencyStore.Configs().Get(value)
			if err != nil {
				return errdefs.System(errors.Wrap(err, "error getting value from config store"))
			}
			// stuff the resulting secret data into a string to use as the
			// CredentialSpec
			credentialSpec = string(csConfig.Spec.Data)
		case "raw":
			credentialSpec = value
		default:
			return errInvalidCredentialSpecSecOpt
		}
	}

	if credentialSpec != "" {
		if s.Windows == nil {
			s.Windows = &specs.Windows{}
		}
		s.Windows.CredentialSpec = credentialSpec
	}

	return nil
}
253510
func (f *Facade) SetPodSpec(args params.SetPodSpecParams) (params.ErrorResults, error) {
	results := params.ErrorResults{
		Results: make([]params.ErrorResult, len(args.Specs)),
	}

	cfg, err := f.model.ModelConfig()
	if err != nil {
		return params.ErrorResults{}, errors.Trace(err)
	}
	provider, err := environs.Provider(cfg.Type())
	if err != nil {
		return params.ErrorResults{}, errors.Trace(err)
	}
	caasProvider, ok := provider.(caas.ContainerEnvironProvider)
	if !ok {
		return params.ErrorResults{}, errors.NotValidf("container environ provider %T", provider)
	}

	for i, arg := range args.Specs {
		tag, err := names.ParseApplicationTag(arg.Tag)
		if err != nil {
			results.Results[i].Error = common.ServerError(common.ErrPerm)
			continue
		}
		if !f.auth.AuthOwner(tag) {
			results.Results[i].Error = common.ServerError(common.ErrPerm)
			continue
		}
		if _, err := caasProvider.ParsePodSpec(arg.Value); err != nil {
			results.Results[i].Error = common.ServerError(errors.New("invalid pod spec"))
			continue
		}
		results.Results[i].Error = common.ServerError(
			f.model.SetPodSpec(tag, arg.Value),
		)
	}
	return results, nil
}
833522
func (s *InputSpecification) SetCodec(v string) *InputSpecification {
	s.Codec = &v
	return s
}
668169
func (s *UpdateMeshInput) SetSpec(v *MeshSpec) *UpdateMeshInput {
	s.Spec = v
	return s
}
874377
func (s *ReservationResourceSpecification) SetCodec(v string) *ReservationResourceSpecification {
	s.Codec = &v
	return s
}
381793
func (st *State) SetPodSpec(appName string, spec string) error {
	if !names.IsValidApplication(appName) {
		return errors.NotValidf("application name %q", appName)
	}
	tag := names.NewApplicationTag(appName)
	var result params.ErrorResults
	args := params.SetPodSpecParams{
		Specs: []params.EntityString{{
			Tag:   tag.String(),
			Value: spec,
		}},
	}
	if err := st.facade.FacadeCall("SetPodSpec", args, &result); err != nil {
		return errors.Trace(err)
	}
	return result.OneError()
}
380704
func (s *GetReservationPurchaseRecommendationInput) SetServiceSpecification(v *ServiceSpecification) *GetReservationPurchaseRecommendationInput {
	s.ServiceSpecification = v
	return s
}
596069
func (s *UpdateBranchInput) SetBuildSpec(v string) *UpdateBranchInput {
	s.BuildSpec = &v
	return s
}
224466
func (s *RegisterThingOutput) SetCertificatePem(v string) *RegisterThingOutput {
	s.CertificatePem = &v
	return s
}