func()

in module/apmazure/blob.go [144:183]


func (b *blobRPC) putOperation(v url.Values, h http.Header) string {
	// header.Get canonicalizes the key, ie. x-ms-copy-source->X-Ms-Copy-Source.
	// The headers used are all lowercase, so we access the map directly.
	_, copySource := h["x-ms-copy-source"]
	_, blobType := h["x-ms-blob-type"]
	_, pageWrite := h["x-ms-page-write"]
	restype := v.Get("restype")
	comp := v.Get("comp")
	if restype == "container" && comp == "acl" {
		return "SetAcl"
	}

	if comp == "" && !(copySource || blobType || pageWrite) {
		return "Create"
	}
	if copySource {
		return "Copy"
	}
	if blobType {
		return "Upload"
	}
	if comp == "page" && pageWrite {
		return "Clear"
	}

	switch comp {
	case "block", "blocklist", "page", "appendblock":
		return "Upload"
	case "copy":
		return "Abort"
	case "metadata":
		return "SetMetadata"
	case "lease", "snapshot", "undelete", "seal", "rename":
		return strings.Title(comp)
	case "properties", "tags", "tier", "expiry":
		return "Set" + strings.Title(comp)
	default:
		return "unknown operation"
	}
}