MCPcopy
hub / github.com/lxc/incus / GetNetworkACLLogfile

Method GetNetworkACLLogfile

client/incus_network_acls.go:83–115  ·  view source on GitHub ↗

GetNetworkACLLogfile returns a reader for the ACL log file. Note that it's the caller's responsibility to close the returned ReadCloser.

(name string)

Source from the content-addressed store, hash-verified

81//
82// Note that it's the caller's responsibility to close the returned ReadCloser.
83func (r *ProtocolIncus) GetNetworkACLLogfile(name string) (io.ReadCloser, error) {
84 if !r.HasExtension("network_acl_log") {
85 return nil, errors.New(`The server is missing the required "network_acl_log" API extension`)
86 }
87
88 // Prepare the HTTP request
89 uri := fmt.Sprintf("%s/1.0/network-acls/%s/log", r.httpBaseURL.String(), url.PathEscape(name))
90 uri, err := r.setQueryAttributes(uri)
91 if err != nil {
92 return nil, err
93 }
94
95 req, err := http.NewRequest("GET", uri, nil)
96 if err != nil {
97 return nil, err
98 }
99
100 // Send the request
101 resp, err := r.DoHTTP(req)
102 if err != nil {
103 return nil, err
104 }
105
106 // Check the return value for a cleaner error
107 if resp.StatusCode != http.StatusOK {
108 _, _, err := incusParseResponse(resp)
109 if err != nil {
110 return nil, err
111 }
112 }
113
114 return resp.Body, err
115}
116
117// CreateNetworkACL defines a new network ACL using the provided struct.
118func (r *ProtocolIncus) CreateNetworkACL(acl api.NetworkACLsPost) error {

Callers

nothing calls this directly

Calls 5

HasExtensionMethod · 0.95
setQueryAttributesMethod · 0.95
DoHTTPMethod · 0.95
incusParseResponseFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected