Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions clients/go/msd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1212,32 +1212,26 @@ func (client MSDClient) GetTransportPolicySnapshots(domainName DomainName, servi
}
}

func (client MSDClient) GetTransportPolicySnapshot(domainName DomainName, serviceName EntityName, snapshotName EntityName, matchingTag string) (*TransportPolicySnapshot, string, error) {
func (client MSDClient) GetTransportPolicySnapshot(domainName DomainName, serviceName EntityName, snapshotName EntityName) (*TransportPolicySnapshot, error) {
var data *TransportPolicySnapshot
headers := map[string]string{
"If-None-Match": matchingTag,
}
url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/service/" + fmt.Sprint(serviceName) + "/snapshot/" + fmt.Sprint(snapshotName)
resp, err := client.httpGet(url, headers)
resp, err := client.httpGet(url, nil)
if err != nil {
return nil, "", err
return data, err
}
defer resp.Body.Close()
switch resp.StatusCode {
case 200, 304:
if 304 != resp.StatusCode {
err = json.NewDecoder(resp.Body).Decode(&data)
if err != nil {
return nil, "", err
}
case 200:
err = json.NewDecoder(resp.Body).Decode(&data)
if err != nil {
return data, err
}
tag := resp.Header.Get(rdl.FoldHttpHeaderName("ETag"))
return data, tag, nil
return data, nil
default:
var errobj rdl.ResourceError
contentBytes, err := io.ReadAll(resp.Body)
if err != nil {
return nil, "", err
return data, err
}
json.Unmarshal(contentBytes, &errobj)
if errobj.Code == 0 {
Expand All @@ -1246,7 +1240,7 @@ func (client MSDClient) GetTransportPolicySnapshot(domainName DomainName, servic
if errobj.Message == "" {
errobj.Message = string(contentBytes)
}
return nil, "", errobj
return data, errobj
}
}

Expand Down
2 changes: 0 additions & 2 deletions clients/go/msd/msd_schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions core/msd/src/main/java/com/yahoo/athenz/msd/MSDSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,6 @@ private static Schema build() {
.pathParam("domainName", "DomainName", "name of the domain")
.pathParam("serviceName", "EntityName", "name of the service")
.pathParam("snapshotName", "EntityName", "name of the snapshot")
.headerParam("If-None-Match", "matchingTag", "String", null, "Retrieved from the previous request, this timestamp specifies to the server to return the snapshot if modified since this time")
.output("ETag", "tag", "String", "The current snapshot modification timestamp is returned in this header")
.auth("msd.GetNetworkPolicy", "{domainName}:service.{serviceName}")
.expected("OK")
.exception("BAD_REQUEST", "ResourceError", "")
Expand Down
4 changes: 1 addition & 3 deletions core/msd/src/main/rdl/Snapshot.rdli
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ resource TransportPolicySnapshot GET "/domain/{domainName}/service/{serviceName}
DomainName domainName; // name of the domain
EntityName serviceName; // name of the service
EntityName snapshotName; // name of the snapshot
String matchingTag (header="If-None-Match"); // Retrieved from the previous request, this timestamp specifies to the server to return the snapshot if modified since this time
String tag (header="ETag", out); // The current snapshot modification timestamp is returned in this header
authorize ("msd.GetNetworkPolicy", "{domainName}:service.{serviceName}");
expected OK, NOT_MODIFIED;
Comment thread
psasidhar marked this conversation as resolved.
expected OK;
exceptions {
ResourceError BAD_REQUEST;
ResourceError NOT_FOUND;
Expand Down
Loading