// CreateQueryObject is temporarily exposed as public to support ConditionalDelete.
// This should be made private again when all mongo implementations are in a single
// package.
168238
func (m *MongoSearcher) CreateQueryObject(query Query) bson.M {
	return m.createQueryObject(query)
}
258692
func (s *BatchWriteOperation) SetCreateObject(v *BatchCreateObject) *BatchWriteOperation {
	s.CreateObject = v
	return s
}
532081
func NewObject(id string, resourceType string, attributes interface{}) (*Object, *Error) {
	object := &Object{
		ID:            id,
		Type:          resourceType,
		Links:         map[string]*Link{},
		Relationships: map[string]*Relationship{},
	}

	rawJSON, err := json.MarshalIndent(attributes, "", " ")
	if err != nil {
		return nil, ISE(fmt.Sprintf("Error marshaling attrs while creating a new JSON Object: %s", err))
	}

	object.Attributes = rawJSON
	return object, nil
}
833593
func (l *LocalStore) NewObject(objectname string) (cloudstorage.Object, error) {
	obj, err := l.Get(context.Background(), objectname)
	if err != nil && err != cloudstorage.ErrObjectNotFound {
		return nil, err
	} else if obj != nil {
		return nil, cloudstorage.ErrObjectExists
	}

	of := path.Join(l.storepath, objectname)
	err = cloudstorage.EnsureDir(of)
	if err != nil {
		return nil, err
	}

	cf := cloudstorage.CachePathObj(l.cachepath, objectname, l.Id)

	return &object{
		name:      objectname,
		storepath: of,
		cachepath: cf,
	}, nil
}
142786
func (m *Client) NewObject(objectname string) (cloudstorage.Object, error) {
	obj, err := m.Get(context.Background(), objectname)
	if err != nil && err != cloudstorage.ErrObjectNotFound {
		return nil, err
	} else if obj != nil {
		return nil, cloudstorage.ErrObjectExists
	}

	cf := cloudstorage.CachePathObj(m.cachepath, objectname, m.ID)
	//gou.DebugCtx(m.clientCtx, "new object cf = %q", cf)

	return &object{
		client: m,
		name:   objectname,
		//metadata: map[string]string{cloudstorage.ContentTypeKey: cloudstorage.ContentType(objectname)},
		//bucket:     m.bucket,
		cachedcopy: nil,
		cachepath:  cf,
	}, nil
}
572023
func (l *b2Objects) DeleteObject(ctx context.Context, bucket string, object string) error {
	bkt, err := l.Bucket(ctx, bucket)
	if err != nil {
		return err
	}
	reader, err := bkt.DownloadFileByName(l.ctx, object, 0, 1)
	if err != nil {
		logger.LogIf(ctx, err)
		return b2ToObjectError(err, bucket, object)
	}
	io.Copy(ioutil.Discard, reader)
	reader.Close()
	err = bkt.File(reader.ID, object).DeleteFileVersion(l.ctx)
	logger.LogIf(ctx, err)
	return b2ToObjectError(err, bucket, object)
}
1359648
func (g *GcsFS) NewObject(objectname string) (cloudstorage.Object, error) {
	obj, err := g.Get(context.Background(), objectname)
	if err != nil && err != cloudstorage.ErrObjectNotFound {
		return nil, err
	} else if obj != nil {
		return nil, cloudstorage.ErrObjectExists
	}

	cf := cloudstorage.CachePathObj(g.cachepath, objectname, g.Id)

	return &object{
		name:       objectname,
		metadata:   map[string]string{cloudstorage.ContentTypeKey: cloudstorage.ContentType(objectname)},
		gcsb:       g.gcsb(),
		bucket:     g.bucket,
		cachedcopy: nil,
		cachepath:  cf,
	}, nil
}
1240646
func (b *Builder) OpenObject(unindexed ...bool) error {
	var vType byte
	if optionalBool(unindexed, false) {
		vType = 0x14
	} else {
		vType = 0x0b
	}
	return WithStack(b.openCompoundValue(vType))
}
739839
func (l *s3EncObjects) DeleteObject(ctx context.Context, bucket string, object string) error {

	// Get dare meta json
	if _, err := l.getGWMetadata(ctx, bucket, getDareMetaPath(object)); err != nil {
		return l.s3Objects.DeleteObject(ctx, bucket, object)
	}
	// delete encrypted object
	l.s3Objects.DeleteObject(ctx, bucket, getGWContentPath(object))
	return l.deleteGWMetadata(ctx, bucket, getDareMetaPath(object))
}
947779
func (r Security_Ssh_Key) CreateObject(templateObject *datatypes.Security_Ssh_Key) (resp datatypes.Security_Ssh_Key, err error) {
	params := []interface{}{
		templateObject,
	}
	err = r.Session.DoRequest("SoftLayer_Security_Ssh_Key", "createObject", params, &r.Options, &resp)
	return
}
942123
func (self *Query) initWithObjectId(document reflect.Value) {

	//If there is nothing to populate, init the fields with object id types
	if len(self.populate) == 0 {

		structElement := document.Elem()
		fieldType := structElement.Type()

		//Iterate over all struct fields
		for fieldIndex := 0; fieldIndex < structElement.NumField(); fieldIndex++ {

			relationTag := fieldType.Field(fieldIndex).Tag.Get("relation")
			field := structElement.Field(fieldIndex)

			if len(relationTag) > 0 {

				if relationTag == REL_1N {

					if field.IsNil() {

						//field.Set(reflect.ValueOf(make([]bson.ObjectId, 0, 0)))

					} else {

						slice := field.Elem()
						idSlice := make([]bson.ObjectId, slice.Len(), slice.Len())

						for index := 0; index < slice.Len(); index++ {
							idSlice[index] = slice.Index(index).Elem().Interface().(bson.ObjectId)
						}

						field.Set(reflect.ValueOf(idSlice))

					}

				} else {

					if !field.IsNil() {

						objectId := field.Elem().Interface().(bson.ObjectId)
						field.Set(reflect.ValueOf(objectId))
					}

					//field.Set(reflect.Zero(reflect.TypeOf(bson.ObjectId(""))))
				}
			}
		}
	}
}
231139
func (in *PersistentVolumeClaimList) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}
902105
func NewObject(t ...[2]*Term) Object {
	obj := newobject(len(t))
	for i := range t {
		obj.Insert(t[i][0], t[i][1])
	}
	return obj
}
1003117
func (in *ClusterResourceQuotaList) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}
1289955
func (l *gcsGateway) DeleteObject(ctx context.Context, bucket string, object string) error {
	err := l.client.Bucket(bucket).Object(object).Delete(ctx)
	if err != nil {
		logger.LogIf(ctx, err)
		return gcsToObjectError(err, bucket, object)
	}

	return nil
}
1301813
func (b *bucket) makeCreateObjectBody(
	req *CreateObjectRequest) (body []byte, err error) {
	// Convert to storagev1.Object.
	rawObject, err := toRawObject(b.Name(), req)
	if err != nil {
		err = fmt.Errorf("toRawObject: %v", err)
		return
	}

	// Serialize.
	body, err = json.Marshal(rawObject)
	if err != nil {
		err = fmt.Errorf("json.Marshal: %v", err)
		return
	}

	return
}
1357300
func (s *Bucket) DeleteObject(objectKey string) (*DeleteObjectOutput, error) {
	r, x, err := s.DeleteObjectRequest(objectKey)

	if err != nil {
		return x, err
	}

	err = r.Send()
	if err != nil {
		return nil, err
	}

	requestID := r.HTTPResponse.Header.Get(http.CanonicalHeaderKey("X-QS-Request-ID"))
	x.RequestID = &requestID

	return x, err
}