// CreateOrUpdateRouteTable invokes az.RouteTablesClient.CreateOrUpdate with exponential backoff retry
971980
func (az *Cloud) CreateOrUpdateRouteTable(routeTable network.RouteTable) error {
	if az.Config.shouldOmitCloudProviderBackoff() {
		ctx, cancel := getContextWithCancel()
		defer cancel()

		resp, err := az.RouteTablesClient.CreateOrUpdate(ctx, az.RouteTableResourceGroup, az.RouteTableName, routeTable)
		return az.processHTTPResponse(nil, "", resp, err)
	}

	return az.createOrUpdateRouteTableWithRetry(routeTable)
}
1216749
func (b *FieldInfosBuilder) AddOrUpdate(name string, fieldType IndexableFieldType) *FieldInfo {
	// TODO: really, indexer shouldn't even call this method (it's only
	// called from DocFieldProcessor); rather, each component in the
	// chain should update what it "owns". E.g., fieldType.indexOptions()
	// should be updated by maybe FreqProxTermsWriterPerField:
	return b.addOrUpdateInternal(name, -1, fieldType.Indexed(), false,
		fieldType.OmitNorms(), false,
		fieldType.IndexOptions(), fieldType.DocValueType(), DocValuesType(0))
}
288999
func (client *Client) DescribeRouteTables(args *DescribeRouteTablesArgs) (routeTables []RouteTableSetType, pagination *common.PaginationResult, err error) {
	response, err := client.DescribeRouteTablesWithRaw(args)
	if err == nil {
		return response.RouteTables.RouteTable, &response.PaginationResult, nil
	}

	return nil, nil, err
}
1197753
func updateByReschedulable(alloc *structs.Allocation, now time.Time, evalID string, d *structs.Deployment) (rescheduleNow, rescheduleLater bool, rescheduleTime time.Time) {
	// If the allocation is part of an ongoing active deployment, we only allow it to reschedule
	// if it has been marked eligible
	if d != nil && alloc.DeploymentID == d.ID && d.Active() && !alloc.DesiredTransition.ShouldReschedule() {
		return
	}

	// Check if the allocation is marked as it should be force rescheduled
	if alloc.DesiredTransition.ShouldForceReschedule() {
		rescheduleNow = true
	}

	// Reschedule if the eval ID matches the alloc's followup evalID or if its close to its reschedule time
	rescheduleTime, eligible := alloc.NextRescheduleTime()
	if eligible && (alloc.FollowupEvalID == evalID || rescheduleTime.Sub(now) <= rescheduleWindowSize) {
		rescheduleNow = true
		return
	}
	if eligible && alloc.FollowupEvalID == "" {
		rescheduleLater = true
	}
	return
}
1049565
func NewRoutePathReverser(apiRoutesProvider RoutesProvider, options ...RoutePathReverserOption) *RoutePathReverser {
	ps := &RoutePathReverser{
		provider: apiRoutesProvider,
	}
	for _, o := range options {
		o(ps)
	}
	return ps
}
695340
func CreateRoutingProfile(db sqlx.Execer, rp *RoutingProfile) error {
	now := time.Now()

	if rp.ID == uuid.Nil {
		var err error
		rp.ID, err = uuid.NewV4()
		if err != nil {
			return errors.Wrap(err, "new uuid v4 error")
		}
	}

	rp.CreatedAt = now
	rp.UpdatedAt = now

	_, err := db.Exec(`
		insert into routing_profile (
			created_at,
			updated_at,

			routing_profile_id,
			as_id,
			ca_cert,
			tls_cert,
			tls_key
		) values ($1, $2, $3, $4, $5, $6, $7)`,
		rp.CreatedAt,
		rp.UpdatedAt,
		rp.ID,
		rp.ASID,
		rp.CACert,
		rp.TLSCert,
		rp.TLSKey,
	)
	if err != nil {
		return handlePSQLError(err, "insert error")
	}

	log.WithFields(log.Fields{
		"id": rp.ID,
	}).Info("routing-profile created")

	return nil
}
952456
func (r *RepoKeyResource) CreateUpdate(owner, repo, key, title string) (*Key, error) {
	if found, err := r.FindName(owner, repo, title); err == nil {
		// if the public keys are different we should update
		if found.Key != key {
			return r.Update(owner, repo, key, title, found.Id)
		}

		// otherwise we should just return the key, since there
		// is nothing to update
		return found, nil
	}

	return r.Create(owner, repo, key, title)
}
1190185
func (a *API) CreateOrUpdateDomain(domain *Domain) (*Domain, error) {
	dst := new(Domain)
	url := a.BuildURL("/v2/domain")
	err := a.Post(url, Params{"upsert": "true"}, domain, dst)
	return dst, err
}
94115
func (az *Cloud) CreateOrUpdateInterface(service *v1.Service, nic network.Interface) error {
	if az.Config.shouldOmitCloudProviderBackoff() {
		ctx, cancel := getContextWithCancel()
		defer cancel()

		resp, err := az.InterfacesClient.CreateOrUpdate(ctx, az.ResourceGroup, *nic.Name, nic)
		klog.V(10).Infof("InterfacesClient.CreateOrUpdate(%s): end", *nic.Name)
		return az.processHTTPResponse(service, "CreateOrUpdateInterface", resp, err)
	}

	return az.createOrUpdateInterfaceWithRetry(service, nic)
}
1290184
func (ec2i *FakeEC2Impl) DescribeRouteTables(request *ec2.DescribeRouteTablesInput) ([]*ec2.RouteTable, error) {
	ec2i.DescribeRouteTablesInput = request
	return ec2i.RouteTables, nil
}
876043
func (s *Stack) GetRouteTable() []tcpip.Route {
	s.mu.Lock()
	defer s.mu.Unlock()
	return append([]tcpip.Route(nil), s.routeTable...)
}
234287
func (s *InputLambdaProcessorUpdate) SetResourceARNUpdate(v string) *InputLambdaProcessorUpdate {
	s.ResourceARNUpdate = &v
	return s
}
386431
func restUpdateAddressable(w http.ResponseWriter, r *http.Request) {
	defer r.Body.Close()
	var ra models.Addressable
	if err := json.NewDecoder(r.Body).Decode(&ra); err != nil {
		LoggingClient.Error(err.Error())
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

	if err := updateAddressable(ra); err != nil {
		switch err.(type) {
		case *types.ErrAddressableNotFound:
			http.Error(w, err.Error(), http.StatusNotFound)
		case *types.ErrAddressableInUse:
			http.Error(w, err.Error(), http.StatusConflict)
		default:
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
		LoggingClient.Error(err.Error())
		return
	}

	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusOK)
	if _, err := w.Write([]byte("true")); err != nil {
		LoggingClient.Error(err.Error())
		return
	}
}
568277
func (r Network_Storage_Backup_Evault) CreateOrUpdateLunId(lunId *int) (resp datatypes.Network_Storage_Property, err error) {
	params := []interface{}{
		lunId,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Storage_Backup_Evault", "createOrUpdateLunId", params, &r.Options, &resp)
	return
}
668825
func (s *LoadBalancerService) NewUpdateGlobalLoadBalancerRuleParams(id string) *UpdateGlobalLoadBalancerRuleParams {
	p := &UpdateGlobalLoadBalancerRuleParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
470244
func (nDB *NetworkDB) createOrUpdateEntry(nid, tname, key string, entry interface{}) (bool, bool) {
	_, okTable := nDB.indexes[byTable].Insert(fmt.Sprintf("/%s/%s/%s", tname, nid, key), entry)
	_, okNetwork := nDB.indexes[byNetwork].Insert(fmt.Sprintf("/%s/%s/%s", nid, tname, key), entry)
	if !okNetwork {
		// Add only if it is an insert not an update
		n, ok := nDB.networks[nDB.config.NodeID][nid]
		if ok {
			n.entriesNumber++
		}
	}
	return okTable, okNetwork
}
1200171
func (f *Function) CreateOrUpdateAlias(alias, version string) error {
	_, err := f.Service.CreateAlias(&lambda.CreateAliasInput{
		FunctionName:    &f.FunctionName,
		FunctionVersion: &version,
		Name:            &alias,
	})

	if err == nil {
		f.Log.WithField("version", version).Infof("created alias %s", alias)
		return nil
	}

	if e, ok := err.(awserr.Error); !ok || e.Code() != "ResourceConflictException" {
		return err
	}

	_, err = f.Service.UpdateAlias(&lambda.UpdateAliasInput{
		FunctionName:    &f.FunctionName,
		FunctionVersion: &version,
		Name:            &alias,
	})

	if err != nil {
		return err
	}

	f.Log.WithField("version", version).Infof("updated alias %s", alias)
	return nil
}