// CreateIRule creates a new iRule on the system.
199171
func (b *BigIP) CreateIRule(name, rule string) error {
	irule := &IRule{
		Name: name,
		Rule: rule,
	}
	return b.post(irule, uriLtm, uriIRule)
}
521395
func (r Route) createURL(host string, params Params) (*url.URL, error) {
	u, err := url.Parse(host)
	if err != nil {
		return nil, err
	}

	path := path.Join(u.Path, r.Path)
	components := strings.Split(path, "/")
	rawComponents := make([]string, len(components))
	copy(rawComponents, components)

	for i, c := range components {
		if len(c) == 0 {
			continue
		}

		val := c
		if c[0] == ':' {
			var ok bool
			val, ok = params[c[1:]]
			if !ok {
				return nil, fmt.Errorf("missing param %s", c)
			}
			components[i] = val
			rawComponents[i] = url.PathEscape(val)
		}
	}

	u.Path = strings.Join(components, "/")
	u.RawPath = strings.Join(rawComponents, "/")

	return u, nil
}
180215
func (t *stiTar) CreateTarFile(base, dir string) (string, error) {
	tarFile, err := ioutil.TempFile(base, "tar")
	defer tarFile.Close()
	if err != nil {
		return "", err
	}
	if err = t.CreateTarStream(dir, false, tarFile); err != nil {
		return "", err
	}
	return tarFile.Name(), nil
}
155273
func (m *GormDefaultRoleMappingRepository) Create(ctx context.Context, u *DefaultRoleMapping) error {
	defer goa.MeasureSince([]string{"goa", "db", "default_role_mapping", "create"}, time.Now())
	if u.DefaultRoleMappingID == uuid.Nil {
		u.DefaultRoleMappingID = uuid.NewV4()
	}
	err := m.db.Create(u).Error
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"default_role_mapping_id": u.DefaultRoleMappingID,
			"err":                     err,
		}, "unable to create the default role mapping")
		return errs.WithStack(err)
	}
	log.Debug(ctx, map[string]interface{}{
		"default_role_mapping_id": u.DefaultRoleMappingID,
	}, "Default role mapping created!")
	return nil
}
202446
func CreateResource(scheme, u string) (string, error) {
	scheme = strings.ToLower(scheme)

	if scheme == "http" || scheme == "https" || scheme == "http*" || scheme == "*" {
		return u, nil
	}

	if scheme == "rtmp" {
		parsed, err := url.Parse(u)
		if err != nil {
			return "", fmt.Errorf("unable to parse rtmp URL, err: %s", err)
		}

		rtmpURL := strings.TrimLeft(parsed.Path, "/")
		if parsed.RawQuery != "" {
			rtmpURL = fmt.Sprintf("%s?%s", rtmpURL, parsed.RawQuery)
		}

		return rtmpURL, nil
	}

	return "", fmt.Errorf("invalid URL scheme must be http, https, or rtmp. Provided: %s", scheme)
}
646382
func (s *Service) CreateSource(ctx context.Context, src *platform.Source) error {
	src.ID = s.IDGenerator.ID()
	if err := s.PutSource(ctx, src); err != nil {
		return &platform.Error{
			Err: err,
		}
	}
	return nil
}
1144882
func (p *Package) CreateSourceFile(name string) (*SourceFile, error) {
	os.RemoveAll(filepath.Join(p.Abs(), name))
	return p.OpenSourceFile(name)
}
36754
func (s *DeploysService) Create(dirOrZip string) (*Deploy, *Response, error) {
	return s.create(dirOrZip, false)
}
856985
func (r *RepoKeyResource) Create(owner, repo, key, title string) (*Key, error) {

	in := Key{Title: title, Key: key}
	out := Key{}
	path := fmt.Sprintf("/repos/%s/%s/keys", owner, repo)
	if err := r.client.do("POST", path, &in, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
1187061
func (c *GitHubClient) CreateRelease(ctx context.Context, req *github.RepositoryRelease) (*github.RepositoryRelease, error) {

	release, res, err := c.Repositories.CreateRelease(context.TODO(), c.Owner, c.Repo, req)
	if err != nil {
		return nil, errors.Wrap(err, "failed to create a release")
	}

	if res.StatusCode != http.StatusCreated {
		return nil, errors.Errorf("create release: invalid status: %s", res.Status)
	}

	return release, nil
}
162925
func (m *Map) CreateLease(u uuid.UUID, l *Lease) bool {
	if _, found := m.uuidMap[u.String()]; found {
		return false
	}
	if _, found := m.nameMap[l.ClusterName]; found {
		return false
	}
	m.uuidMap[u.String()] = l
	m.nameMap[l.ClusterName] = u
	return true
}
983937
func (r *Repository) CreateRemote(c *config.RemoteConfig) (*Remote, error) {
	if err := c.Validate(); err != nil {
		return nil, err
	}

	remote := newRemote(r.Storer, c)

	cfg, err := r.Storer.Config()
	if err != nil {
		return nil, err
	}

	if _, ok := cfg.Remotes[c.Name]; ok {
		return nil, ErrRemoteExists
	}

	cfg.Remotes[c.Name] = c
	return remote, r.Storer.SetConfig(cfg)
}
361332
func (api *API) CreateUserAccessRule(accessRule AccessRule) (*AccessRuleResponse, error) {
	return api.createAccessRule("/user", accessRule)
}
862233
func (s *ClusterPairServer) Create(
	ctx context.Context,
	req *api.SdkClusterPairCreateRequest,
) (*api.SdkClusterPairCreateResponse, error) {
	if s.cluster() == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	if req.GetRequest() == nil {
		return nil, status.Errorf(codes.InvalidArgument, "Must supply valid request")
	}

	resp, err := s.cluster().CreatePair(req.GetRequest())
	if err != nil {
		return nil, status.Errorf(codes.Internal, "Cannot create cluster with remote pair %s : %v",
			req.GetRequest().GetRemoteClusterIp(), err)
	}

	return &api.SdkClusterPairCreateResponse{
		Result: resp,
	}, nil
}
95710
func (s *SourceService) CreateSource(ctx context.Context, source *platform.Source) error {
	return s.CreateSourceFn(ctx, source)
}
117678
func (o *CreateRoleOptions) RunCreateRole() error {
	role := &rbacv1.Role{
		// this is ok because we know exactly how we want to be serialized
		TypeMeta: metav1.TypeMeta{APIVersion: rbacv1.SchemeGroupVersion.String(), Kind: "Role"},
	}
	role.Name = o.Name
	rules, err := generateResourcePolicyRules(o.Mapper, o.Verbs, o.Resources, o.ResourceNames, []string{})
	if err != nil {
		return err
	}
	role.Rules = rules

	// Create role.
	if !o.DryRun {
		role, err = o.Client.Roles(o.Namespace).Create(role)
		if err != nil {
			return err
		}
	}

	return o.PrintObj(role)
}
255457
func (c *Client) CreateLoadBalancerRule(p *CreateLoadBalancerRuleParameter) (*LoadBalancerRule, error) {
	obj, err := c.Request("createLoadBalancerRule", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*LoadBalancerRule), err
}