GetNetworkACLLogfile returns a reader for the ACL log file. Note that it's the caller's responsibility to close the returned ReadCloser.
(name string)
| 81 | // |
| 82 | // Note that it's the caller's responsibility to close the returned ReadCloser. |
| 83 | func (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. |
| 118 | func (r *ProtocolIncus) CreateNetworkACL(acl api.NetworkACLsPost) error { |
nothing calls this directly
no test coverage detected