in e2etest/declarativeWithPropertyProviders.go [76:189]
func (w with) createObjectProperties() *objectProperties {
result := &objectProperties{}
populated := false
ensureContentPropsExist := func() {
if result.contentHeaders == nil {
result.contentHeaders = &contentHeaders{}
}
}
if w.size != "" {
populated = true
longSize, err := cmd.ParseSizeString(w.size, "with.size")
common.PanicIfErr(err) // TODO: any better option?
result.size = &longSize
}
// content headers
if w.symlinkTarget != "" {
populated = true
result.symlinkTarget = &w.symlinkTarget
}
if w.cacheControl != "" {
populated = true
ensureContentPropsExist()
result.contentHeaders.cacheControl = &w.cacheControl
}
if w.contentDisposition != "" {
populated = true
ensureContentPropsExist()
result.contentHeaders.contentDisposition = &w.contentDisposition
}
if w.contentEncoding != "" {
populated = true
ensureContentPropsExist()
result.contentHeaders.contentEncoding = &w.contentEncoding
}
if w.contentLanguage != "" {
populated = true
ensureContentPropsExist()
result.contentHeaders.contentLanguage = &w.contentLanguage
}
if w.contentMD5 != nil {
populated = true
ensureContentPropsExist()
result.contentHeaders.contentMD5 = w.contentMD5
}
if w.contentType != "" {
populated = true
ensureContentPropsExist()
result.contentHeaders.contentType = &w.contentType
}
// other properties
if w.nameValueMetadata != nil {
populated = true
result.nameValueMetadata = w.nameValueMetadata
}
if w.blobTags != "" {
populated = true
result.blobTags = common.ToCommonBlobTagsMap(w.blobTags)
}
if w.blobType != common.EBlobType.Detect() {
populated = true
result.blobType = w.blobType
}
if w.blobVersions > 0 {
populated = true
result.blobVersions = &w.blobVersions
}
if w.lastWriteTime != (time.Time{}) {
populated = true
result.lastWriteTime = &w.lastWriteTime
}
if w.creationTime != (time.Time{}) {
populated = true
result.creationTime = &w.creationTime
}
if w.smbAttributes != 0 {
populated = true
result.smbAttributes = &w.smbAttributes
}
if w.smbPermissionsSddl != "" {
populated = true
result.smbPermissionsSddl = &w.smbPermissionsSddl
}
if w.adlsPermissionsACL != "" {
populated = true
result.adlsPermissionsACL = &w.adlsPermissionsACL
}
if !w.posixProperties.Empty() {
populated = true
result.posixProperties = &w.posixProperties
}
if w.cpkByName != "" {
populated = true
cpkScopeInfo := common.GetCpkScopeInfo(w.cpkByName)
result.cpkScopeInfo = cpkScopeInfo
}
if w.cpkByValue {
populated = true
cpkInfo := common.GetCpkInfo(w.cpkByValue)
result.cpkInfo = cpkInfo
}
if populated {
return result
} else {
return nil // this gives consumers a shortcut way to know "there is no validation to do here", and so avoid expensive network calls to get destination properties when there is no validation needed
}
}