Skip to content

Commit 839dc29

Browse files
authored
add internal snapshot support for app config (Azure#21914)
1 parent dd478f9 commit 839dc29

File tree

9 files changed

+1164
-119
lines changed

9 files changed

+1164
-119
lines changed

sdk/data/azappconfig/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "go",
44
"TagPrefix": "go/data/azappconfig",
5-
"Tag": "go/data/azappconfig_2936265210"
5+
"Tag": "go/data/azappconfig_ec954b99e7"
66
}

sdk/data/azappconfig/client.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package azappconfig
99
import (
1010
"context"
1111
"fmt"
12-
"net/http"
1312
"net/url"
1413
"time"
1514

@@ -139,19 +138,10 @@ func (c *Client) GetSetting(ctx context.Context, key string, options *GetSetting
139138
return GetSettingResponse{}, err
140139
}
141140

142-
var lastModified *time.Time
143-
if resp.LastModified != nil {
144-
tt, err := time.Parse(http.TimeFormat, *resp.LastModified)
145-
if err != nil {
146-
return GetSettingResponse{}, err
147-
}
148-
lastModified = &tt
149-
}
150-
151141
return GetSettingResponse{
152142
Setting: settingFromGenerated(resp.KeyValue),
153143
SyncToken: SyncToken(*resp.SyncToken),
154-
LastModified: lastModified,
144+
LastModified: resp.KeyValue.LastModified,
155145
}, nil
156146
}
157147

sdk/data/azappconfig/internal/appconfiguration_ext.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"200": {
3636
"description": "Success",
3737
"schema": {
38-
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/e01d8afe9be7633ed36db014af16d47fec01f737/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json#/definitions/KeyListResult"
38+
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/1d5799e57a1bbe66a86afc246d363d8163625b45/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-10-01/appconfiguration.json#/definitions/KeyListResult"
3939
},
4040
"headers": {
4141
"Sync-Token": {
@@ -47,7 +47,7 @@
4747
"default": {
4848
"description": "Error response describing why the operation failed",
4949
"schema": {
50-
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/e01d8afe9be7633ed36db014af16d47fec01f737/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json#/definitions/Error"
50+
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/1d5799e57a1bbe66a86afc246d363d8163625b45/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-10-01/appconfiguration.json#/definitions/Error"
5151
}
5252
}
5353
}

sdk/data/azappconfig/internal/autorest.md

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ These settings apply only when `--go` is specified on the command line.
66
go: true
77
version: "^3.0.0"
88
input-file:
9-
- https://github.com/Azure/azure-rest-api-specs/blob/e01d8afe9be7633ed36db014af16d47fec01f737/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json
9+
- https://github.com/Azure/azure-rest-api-specs/blob/1d5799e57a1bbe66a86afc246d363d8163625b45/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-10-01/appconfiguration.json
1010
- appconfiguration_ext.json
1111
license-header: MICROSOFT_MIT_NO_VERSION
1212
clear-output-folder: false
@@ -15,56 +15,18 @@ output-folder: generated
1515
openapi-type: "data-plane"
1616
security: "AADToken"
1717
use: "@autorest/go@4.0.0-preview.51"
18+
modelerfour:
19+
lenient-model-deduplication: true
1820
```
1921
20-
### Fix up enums
21-
22-
``` yaml
22+
### Fix up parameter names
23+
```yaml
2324
directive:
25+
# Directive renaming "KeyValueFields" value to "SettingFields".
2426
- from: swagger-document
25-
where: $.paths./kv
26-
transform: >
27-
$.get.parameters[6].items["x-ms-enum"] = {
28-
"name": "SettingFields",
29-
"modelAsString": true
30-
};
31-
$.head.parameters[6].items["x-ms-enum"] = {
32-
"name": "SettingFields",
33-
"modelAsString": true
34-
};
35-
- from: swagger-document
36-
where: $.paths./kv/{key}
27+
where: '$.parameters.KeyValueFields.items.x-ms-enum'
3728
transform: >
38-
$.get.parameters[7].items["x-ms-enum"] = {
39-
"name": "SettingFields",
40-
"modelAsString": true
41-
};
42-
$.head.parameters[7].items["x-ms-enum"] = {
43-
"name": "SettingFields",
44-
"modelAsString": true
45-
};
46-
- from: swagger-document
47-
where: $.paths./labels
48-
transform: >
49-
$.get.parameters[5].items["x-ms-enum"] = {
50-
"name": "LabelFields",
51-
"modelAsString": true
52-
};
53-
$.head.parameters[5].items["x-ms-enum"] = {
54-
"name": "LabelFields",
55-
"modelAsString": true
56-
};
57-
- from: swagger-document
58-
where: $.paths./revisions
59-
transform: >
60-
$.get.parameters[6].items["x-ms-enum"] = {
61-
"name": "SettingFields",
62-
"modelAsString": true
63-
};
64-
$.head.parameters[6].items["x-ms-enum"] = {
65-
"name": "SettingFields",
66-
"modelAsString": true
67-
};
29+
$["name"] = "SettingFields";
6830
```
6931
7032
### Fix up pagers
@@ -80,4 +42,4 @@ directive:
8042
return $.
8143
replace(/urlPath\s+:=\s+"\/\{nextLink\}"/, "urlPath := nextLink").
8244
replace(/\s+urlPath\s+=\s+strings\.ReplaceAll\(urlPath, "\{nextLink\}", nextLink\)/, "");
83-
```
45+
```

0 commit comments

Comments
 (0)