// AdoptResources is part of the Environ interface.
978997
func (env *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {
	instances, err := env.AllInstances(ctx)
	if err != nil {
		return errors.Annotate(err, "all instances")
	}

	var stringIds []string
	for _, id := range instances {
		stringIds = append(stringIds, string(id.Id()))
	}
	err = env.gce.UpdateMetadata(tags.JujuController, controllerUUID, stringIds...)
	if err != nil {
		return google.HandleCredentialError(errors.Trace(err), ctx)
	}
	return nil
}
196889
func (s *ResourceDefinitionVersion) SetResources(v []*Resource) *ResourceDefinitionVersion {
	s.Resources = v
	return s
}
810208
func newBaseResource(p string, fi os.FileInfo) (*resource, error) {
	// TODO(stevvooe): This need to be resolved for the container's root,
	// where here we are really getting the host OS's value. We need to allow
	// this be passed in and fixed up to make these uid/gid mappings portable.
	// Either this can be part of the driver or we can achieve it through some
	// other mechanism.
	sys, ok := fi.Sys().(*syscall.Stat_t)
	if !ok {
		// TODO(stevvooe): This may not be a hard error for all platforms. We
		// may want to move this to the driver.
		return nil, fmt.Errorf("unable to resolve syscall.Stat_t from (os.FileInfo).Sys(): %#v", fi)
	}

	return &resource{
		paths: []string{p},
		mode:  fi.Mode(),

		uid: int64(sys.Uid),
		gid: int64(sys.Gid),

		// NOTE(stevvooe): Population of shared xattrs field is deferred to
		// the resource types that populate it. Since they are a property of
		// the context, they must set there.
	}, nil
}
485899
func (d *CachedDiscoveryClient) ServerResources() ([]*metav1.APIResourceList, error) {
	_, rs, err := discovery.ServerGroupsAndResources(d)
	return rs, err
}
598692
func GetResourcesAndPairs(args []string, pairType string) (resources []string, pairArgs []string, err error) {
	foundPair := false
	for _, s := range args {
		nonResource := (strings.Contains(s, "=") && s[0] != '=') || (strings.HasSuffix(s, "-") && s != "-")
		switch {
		case !foundPair && nonResource:
			foundPair = true
			fallthrough
		case foundPair && nonResource:
			pairArgs = append(pairArgs, s)
		case !foundPair && !nonResource:
			resources = append(resources, s)
		case foundPair && !nonResource:
			err = fmt.Errorf("all resources must be specified before %s changes: %s", pairType, s)
			return
		}
	}
	return
}
922499
func (s *Event) SetResources(v []*Resource) *Event {
	s.Resources = v
	return s
}
967438
func Convert_v1_EnvFromSource_To_core_EnvFromSource(in *v1.EnvFromSource, out *core.EnvFromSource, s conversion.Scope) error {
	return autoConvert_v1_EnvFromSource_To_core_EnvFromSource(in, out, s)
}
111036
func (s *PutEventsRequestEntry) SetResources(v []*string) *PutEventsRequestEntry {
	s.Resources = v
	return s
}
739953
func NewEnvConfigurationSource() core.ConfigSource {
	envConfigSource := new(EnvConfigurationSource)
	envConfigSource.priority = envVariableSourcePriority
	config, err := envConfigSource.pullConfigurations()
	if err != nil {
		openlogging.GetLogger().Error("failed to initialize environment configurations: " + err.Error())
		return envConfigSource
	}
	envConfigSource.Configurations = config

	return envConfigSource
}
214371
func (s *RoleUsageType) SetResources(v []*string) *RoleUsageType {
	s.Resources = v
	return s
}
326774
func (up *tenantURLProvider) GetEnvironmentMapping() map[string]string {
	result := make(map[string]string)
	// Exclude internal namespaces where the user cannot deploy applications

	// Deployments API will receive requests by environment name (e.g. "run", "stage").
	// These names correspond to the "type" attribute in Namespaces.
	for envNS, attr := range up.namespaces {
		envName := attr.Type
		if envName == nil || len(*envName) == 0 {
			log.Error(nil, map[string]interface{}{
				"namespace": envNS,
			}, "namespace has no type")
		} else {
			result[*envName] = envNS
		}
	}
	return result
}
415609
func ReserveResources(a mesos.AgentID, r ...mesos.Resource) *master.Call {
	return &master.Call{
		Type: master.Call_RESERVE_RESOURCES,
		ReserveResources: &master.Call_ReserveResources{
			AgentID:   a,
			Resources: r,
		},
	}
}
783895
func GetMetadataSources(env environs.BootstrapEnviron) ([]simplestreams.DataSource, error) {
	config := env.Config()

	// Add configured and environment-specific datasources.
	var sources []simplestreams.DataSource
	if userURL, ok := config.AgentMetadataURL(); ok {
		verify := utils.VerifySSLHostnames
		if !config.SSLHostnameVerification() {
			verify = utils.NoVerifySSLHostnames
		}
		sources = append(sources, simplestreams.NewURLSignedDataSource(conf.AgentMetadataURLKey, userURL, keys.JujuPublicKey, verify, simplestreams.SPECIFIC_CLOUD_DATA, false))
	}

	envDataSources, err := environmentDataSources(env)
	if err != nil {
		return nil, err
	}
	sources = append(sources, envDataSources...)

	// Add the default, public datasource.
	defaultURL, err := ToolsURL(DefaultBaseURL)
	if err != nil {
		return nil, err
	}
	if defaultURL != "" {
		sources = append(sources,
			simplestreams.NewURLSignedDataSource("default simplestreams", defaultURL, keys.JujuPublicKey, utils.VerifySSLHostnames, simplestreams.DEFAULT_CLOUD_DATA, true))
	}
	return sources, nil
}
948895
func (s *ProjectDetails) SetResources(v []*Resource) *ProjectDetails {
	s.Resources = v
	return s
}
474633
func (s *UpdateJobInput) SetResources(v *JobResource) *UpdateJobInput {
	s.Resources = v
	return s
}
1023301
func (r Resource_Metadata) GetServiceResources() (resp []datatypes.Container_Resource_Metadata_ServiceResource, err error) {
	err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getServiceResources", nil, &r.Options, &resp)
	return
}
499965
func (s *Handshake) SetResources(v []*HandshakeResource) *Handshake {
	s.Resources = v
	return s
}