// createSupplementalGroupStrategy creates a new supplemental group strategy
761381
func createSupplementalGroupStrategy(opts *securityapi.SupplementalGroupsStrategyOptions) (group.GroupSecurityContextConstraintsStrategy, error) {
	switch opts.Type {
	case securityapi.SupplementalGroupsStrategyRunAsAny:
		return group.NewRunAsAny()
	case securityapi.SupplementalGroupsStrategyMustRunAs:
		return group.NewMustRunAs(opts.Ranges, supplementalGroupsField)
	default:
		return nil, fmt.Errorf("Unrecognized SupplementalGroups strategy type %s", opts.Type)
	}
}
793958
func (ac *APIController) ExtContractsGroupCreate(contractsGroup *contivModel.ExtContractsGroup) error {
	log.Infof("Received ExtContractsGroupCreate: %+v", contractsGroup)

	// Validate contracts type
	if contractsGroup.ContractsType != "provided" && contractsGroup.ContractsType != "consumed" {
		return core.Errorf("Contracts group need to be either 'provided' or 'consumed'")
	}
	// Make sure the tenant exists
	tenant := contivModel.FindTenant(contractsGroup.TenantName)
	if tenant == nil {
		return core.Errorf("Tenant %s not found", contractsGroup.TenantName)
	}

	// NOTE: Nothing more needs to be done here. This object
	// need not be created in the masterCfg.

	return nil
}
850641
func (o *OverlayManagementProfile) CreateOverlayManagementSubnetProfile(child *OverlayManagementSubnetProfile) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
910021
func (o *Me) CreateDUCGroup(child *DUCGroup) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
714340
func (client *Client) CreateScalingGroup(args *CreateScalingGroupArgs) (resp *CreateScalingGroupResponse, err error) {
	response := CreateScalingGroupResponse{}
	err = client.InvokeByFlattenMethod("CreateScalingGroup", args, &response)

	if err != nil {
		return nil, err
	}
	return &response, nil
}
95459
func (u Util) CreateGroup(g types.PasswdGroup) error {
	args := []string{"--root", u.DestDir}

	if g.Gid != nil {
		args = append(args, "--gid",
			strconv.FormatUint(uint64(*g.Gid), 10))
	}

	if g.PasswordHash != nil && *g.PasswordHash != "" {
		args = append(args, "--password", *g.PasswordHash)
	} else {
		args = append(args, "--password", "*")
	}

	if g.System != nil && *g.System {
		args = append(args, "--system")
	}

	args = append(args, g.Name)

	_, err := u.LogCmd(exec.Command(distro.GroupaddCmd(), args...),
		"adding group %q", g.Name)
	return err
}
608127
func (g *BuilderGroup) AddGroup(info string) *BuilderGroup {
	return g.builder.AddGroup(info, g)
}
88834
func (s stage) createGroups(config types.Config) error {
	if len(config.Passwd.Groups) == 0 {
		return nil
	}
	s.Logger.PushPrefix("createGroups")
	defer s.Logger.PopPrefix()

	for _, g := range config.Passwd.Groups {
		if err := s.CreateGroup(g); err != nil {
			return fmt.Errorf("failed to create group %q: %v",
				g.Name, err)
		}
	}

	return nil
}
395168
func (s *CreateOptionGroupOutput) SetOptionGroup(v *OptionGroup) *CreateOptionGroupOutput {
	s.OptionGroup = v
	return s
}
830214
func NewStrategy(registryWhitelister whitelist.RegistryWhitelister) Strategy {
	return Strategy{
		ObjectTyper:         legacyscheme.Scheme,
		registryWhitelister: registryWhitelister,
	}
}
969543
func Convert_security_SupplementalGroupsStrategyOptions_To_v1_SupplementalGroupsStrategyOptions(in *security.SupplementalGroupsStrategyOptions, out *v1.SupplementalGroupsStrategyOptions, s conversion.Scope) error {
	return autoConvert_security_SupplementalGroupsStrategyOptions_To_v1_SupplementalGroupsStrategyOptions(in, out, s)
}
397860
func (ac *APIController) EndpointGroupCreate(endpointGroup *contivModel.EndpointGroup) error {
	log.Infof("Received EndpointGroupCreate: %+v", endpointGroup)

	// Find the tenant
	tenant := contivModel.FindTenant(endpointGroup.TenantName)
	if tenant == nil {
		return core.Errorf("Tenant not found")
	}
	// Find the network
	nwObjKey := endpointGroup.TenantName + ":" + endpointGroup.NetworkName
	network := contivModel.FindNetwork(nwObjKey)
	if network == nil {
		return core.Errorf("Network %s not found", endpointGroup.NetworkName)
	}
	// If there is a Network with the same name as this endpointGroup, reject.
	nameClash := contivModel.FindNetwork(endpointGroup.Key)
	if nameClash != nil {
		return core.Errorf("Network %s conflicts with the endpointGroup name",
			nameClash.NetworkName)
	}
	// create the endpoint group state
	err := master.CreateEndpointGroup(endpointGroup.TenantName, endpointGroup.NetworkName,
		endpointGroup.GroupName, endpointGroup.IpPool, endpointGroup.CfgdTag)
	if err != nil {
		log.Errorf("Error creating endpoint group %+v. Err: %v", endpointGroup, err)
		return err
	}
	// for each policy create an epg policy Instance
	for _, policyName := range endpointGroup.Policies {
		policyKey := GetpolicyKey(endpointGroup.TenantName, policyName)
		// find the policy
		policy := contivModel.FindPolicy(policyKey)
		if policy == nil {
			log.Errorf("Could not find policy %s", policyName)
			endpointGroupCleanup(endpointGroup)
			return core.Errorf("Policy not found")
		}

		// attach policy to epg
		err = master.PolicyAttach(endpointGroup, policy)
		if err != nil {
			log.Errorf("Error attaching policy %s to epg %s", policyName, endpointGroup.Key)
			endpointGroupCleanup(endpointGroup)
			return err
		}

		// establish Links
		modeldb.AddLinkSet(&policy.LinkSets.EndpointGroups, endpointGroup)
		modeldb.AddLinkSet(&endpointGroup.LinkSets.Policies, policy)

		// Write the policy
		err = policy.Write()
		if err != nil {
			endpointGroupCleanup(endpointGroup)
			return err
		}
	}

	// If endpoint group is to be attached to any netprofile, then attach the netprofile and create links and linksets.
	if endpointGroup.NetProfile != "" {
		profileKey := GetNetprofileKey(endpointGroup.TenantName, endpointGroup.NetProfile)
		netprofile := contivModel.FindNetprofile(profileKey)
		if netprofile == nil {
			log.Errorf("Error finding netprofile: %s", profileKey)
			return errors.New("netprofile not found")
		}

		// attach NetProfile to epg
		err = master.UpdateEndpointGroup(netprofile.Bandwidth, endpointGroup.GroupName, endpointGroup.TenantName, netprofile.DSCP, netprofile.Burst)
		if err != nil {
			log.Errorf("Error attaching NetProfile %s to epg %s", endpointGroup.NetProfile, endpointGroup.Key)
			endpointGroupCleanup(endpointGroup)
			return err
		}

		//establish links (epg - netprofile)
		modeldb.AddLink(&endpointGroup.Links.NetProfile, netprofile)
		//establish linksets (Netprofile - epg)
		modeldb.AddLinkSet(&netprofile.LinkSets.EndpointGroups, endpointGroup)

		//Write the attached Netprofile to modeldb
		err = netprofile.Write()
		if err != nil {
			endpointGroupCleanup(endpointGroup)
			return err
		}
	}

	// Setup external contracts this EPG might have.
	err = setupExternalContracts(endpointGroup, endpointGroup.ExtContractsGrps)
	if err != nil {
		log.Errorf("Error setting up external contracts for epg %s", endpointGroup.Key)
		endpointGroupCleanup(endpointGroup)
		return err
	}

	// Setup links
	modeldb.AddLink(&endpointGroup.Links.Network, network)
	modeldb.AddLink(&endpointGroup.Links.Tenant, tenant)
	modeldb.AddLinkSet(&network.LinkSets.EndpointGroups, endpointGroup)
	modeldb.AddLinkSet(&tenant.LinkSets.EndpointGroups, endpointGroup)

	// Save the tenant and network since we added the links
	err = network.Write()
	if err != nil {
		endpointGroupCleanup(endpointGroup)
		return err
	}

	err = tenant.Write()
	if err != nil {
		endpointGroupCleanup(endpointGroup)
		return err
	}

	return nil
}
54936
func createUserStrategy(opts *securityapi.RunAsUserStrategyOptions) (user.RunAsUserSecurityContextConstraintsStrategy, error) {
	switch opts.Type {
	case securityapi.RunAsUserStrategyMustRunAs:
		return user.NewMustRunAs(opts)
	case securityapi.RunAsUserStrategyMustRunAsRange:
		return user.NewMustRunAsRange(opts)
	case securityapi.RunAsUserStrategyMustRunAsNonRoot:
		return user.NewRunAsNonRoot(opts)
	case securityapi.RunAsUserStrategyRunAsAny:
		return user.NewRunAsAny(opts)
	default:
		return nil, fmt.Errorf("Unrecognized RunAsUser strategy type %s", opts.Type)
	}
}
1304626
func (s *VMGroupService) CreateInstanceGroup(p *CreateInstanceGroupParams) (*CreateInstanceGroupResponse, error) {
	resp, err := s.cs.newRequest("createInstanceGroup", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r CreateInstanceGroupResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1086517
func NewStrategy(typer runtime.ObjectTyper) rest.RESTCreateUpdateStrategy {
	return apiServerStrategy{typer, names.SimpleNameGenerator}
}
342101
func (o *Me) CreateNSRedundantGatewayGroup(child *NSRedundantGatewayGroup) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
727896
func (r *marathonClient) CreateGroup(group *Group) error {
	return r.apiPost(marathonAPIGroups, group, nil)
}