-
Notifications
You must be signed in to change notification settings - Fork 165
/
applens_detector_request_options.go
59 lines (48 loc) · 1.42 KB
/
applens_detector_request_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package applens
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"fmt"
"net/http"
"time"
gofrsuuid "github.com/gofrs/uuid"
)
// GetDetectorOptions includes options for GetDetector operation.
type GetDetectorOptions struct {
ResourceID string
DetectorID string
Location string
}
func (options *GetDetectorOptions) toHeader() http.Header {
if options.ResourceID == "" || options.DetectorID == "" {
return nil
}
id := gofrsuuid.Must(gofrsuuid.NewV4()).String()
header := http.Header{
headerXmsClientRequestId: {id},
headerXmsDate: {time.Now().UTC().Format(http.TimeFormat)},
headerXmsPathQuery: {fmt.Sprintf("%s/detectors/%s", options.ResourceID, options.DetectorID)},
headerXmsRequestId: {id},
headerXmsVerb: {"POST"},
}
return header
}
// ListDetectorOptions includes options for ListDetector operation.
type ListDetectorsOptions struct {
ResourceID string
Location string
}
func (options *ListDetectorsOptions) toHeader() http.Header {
if options.ResourceID == "" {
return nil
}
id := gofrsuuid.Must(gofrsuuid.NewV4()).String()
header := http.Header{
headerXmsClientRequestId: {id},
headerXmsDate: {time.Now().UTC().Format(http.TimeFormat)},
headerXmsPathQuery: {fmt.Sprintf("%s/detectors", options.ResourceID)},
headerXmsRequestId: {id},
headerXmsVerb: {"POST"},
}
return header
}