// SetPackageHidden updates Hidden field of the package.
//
// If the package is missing returns datastore.ErrNoSuchEntity. All other errors
// are transient.
436574
func SetPackageHidden(c context.Context, pkg string, hidden bool) error {
	return Txn(c, "SetPackageHidden", func(c context.Context) error {
		p := &Package{Name: pkg}
		switch err := datastore.Get(c, p); {
		case err == datastore.ErrNoSuchEntity:
			return err
		case err != nil:
			return transient.Tag.Apply(err)
		case p.Hidden == hidden:
			return nil
		}

		p.Hidden = hidden
		if err := datastore.Put(c, p); err != nil {
			return transient.Tag.Apply(err)
		}

		ev := api.EventKind_PACKAGE_HIDDEN
		if !hidden {
			ev = api.EventKind_PACKAGE_UNHIDDEN
		}
		return EmitEvent(c, &api.Event{Kind: ev, Package: pkg})
	})
}
1360983
func (s *Layer) SetPackages(v []*string) *Layer {
	s.Packages = v
	return s
}
1244005
func (s *CreateInstanceProfileInput) SetPackageCleanup(v bool) *CreateInstanceProfileInput {
	s.PackageCleanup = &v
	return s
}
756110
func (sys *System) detectPackage(c *cli.Context) {
	p := c.GlobalString("package")
	if p != "deb" && p != "apk" && p != "pacman" && p != "rpm" {
		p = DetectPackageManager()
	}
	switch p {
	case "deb":
		sys.NewPackage = NewDebPackage
	case "apk":
		sys.NewPackage = NewAlpinePackage
	case "pacman":
		sys.NewPackage = NewPacmanPackage
	default:
		sys.NewPackage = NewRpmPackage
	}
}
171091
func (s *UpdateOriginEndpointInput) SetCmafPackage(v *CmafPackageCreateOrUpdateParameters) *UpdateOriginEndpointInput {
	s.CmafPackage = v
	return s
}
15632
func (s *DescribeModelPackageInput) SetModelPackageName(v string) *DescribeModelPackageInput {
	s.ModelPackageName = &v
	return s
}
1360378
func (s *SubmitTaskStateChangeOutput) SetAcknowledgment(v string) *SubmitTaskStateChangeOutput {
	s.Acknowledgment = &v
	return s
}
309580
func (r Product_Package_Preset) GetPackageConfiguration() (resp []datatypes.Product_Package_Order_Configuration, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Package_Preset", "getPackageConfiguration", nil, &r.Options, &resp)
	return
}
529260
func (s *UpdateLayerInput) SetPackages(v []*string) *UpdateLayerInput {
	s.Packages = v
	return s
}
1048378
func (s *ModelPackageSummary) SetModelPackageArn(v string) *ModelPackageSummary {
	s.ModelPackageArn = &v
	return s
}
143589
func (s *CreateOriginEndpointInput) SetDashPackage(v *DashPackage) *CreateOriginEndpointInput {
	s.DashPackage = v
	return s
}
1075479
func (s *UpdateFileSystemOutput) SetEncrypted(v bool) *UpdateFileSystemOutput {
	s.Encrypted = &v
	return s
}
422518
func (s *UpdateReplicationJobInput) SetEncrypted(v bool) *UpdateReplicationJobInput {
	s.Encrypted = &v
	return s
}
223751
func HiddenFieldFromInstance(val reflect.Value, t reflect.Type, fieldNo int, name string) *Field {
	ret := HiddenField(name)
	ret.SetValue(fmt.Sprintf("%v", val.Field(fieldNo).Interface()))
	return ret
}
1053565
func (g *Generator) SetPackageNames() {
	// Register the name for this package.  It will be the first name
	// registered so is guaranteed to be unmodified.
	pkg, explicit := g.genFiles[0].goPackageName()

	// Check all files for an explicit go_package option.
	for _, f := range g.genFiles {
		thisPkg, thisExplicit := f.goPackageName()
		if thisExplicit {
			if !explicit {
				// Let this file's go_package option serve for all input files.
				pkg, explicit = thisPkg, true
			} else if thisPkg != pkg {
				g.Fail("inconsistent package names:", thisPkg, pkg)
			}
		}
	}

	// If we don't have an explicit go_package option but we have an
	// import path, use that.
	if !explicit {
		p := g.defaultGoPackage()
		if p != "" {
			pkg, explicit = p, true
		}
	}

	// If there was no go_package and no import path to use,
	// double-check that all the inputs have the same implicit
	// Go package name.
	if !explicit {
		for _, f := range g.genFiles {
			thisPkg, _ := f.goPackageName()
			if thisPkg != pkg {
				g.Fail("inconsistent package names:", thisPkg, pkg)
			}
		}
	}

	g.packageName = RegisterUniquePackageName(pkg, g.genFiles[0])

	// Register the support package names. They might collide with the
	// name of a package we import.
	g.Pkg = map[string]string{
		"fmt":          RegisterUniquePackageName("fmt", nil),
		"math":         RegisterUniquePackageName("math", nil),
		"proto":        RegisterUniquePackageName("proto", nil),
		"golang_proto": RegisterUniquePackageName("golang_proto", nil),
	}

AllFiles:
	for _, f := range g.allFiles {
		for _, genf := range g.genFiles {
			if f == genf {
				// In this package already.
				uniquePackageName[f.FileDescriptorProto] = g.packageName
				continue AllFiles
			}
		}
		// The file is a dependency, so we want to ignore its go_package option
		// because that is only relevant for its specific generated output.
		pkg := f.GetPackage()
		if pkg == "" {
			pkg = baseName(*f.Name)
		}
		RegisterUniquePackageName(pkg, f)
	}
}
967581
func (s *UpdateOriginEndpointOutput) SetCmafPackage(v *CmafPackage) *UpdateOriginEndpointOutput {
	s.CmafPackage = v
	return s
}
790908
func (s *DescribeModelPackageOutput) SetModelPackageDescription(v string) *DescribeModelPackageOutput {
	s.ModelPackageDescription = &v
	return s
}