Skip to content

Instantly share code, notes, and snippets.

@lmazuel
Created July 19, 2024 21:04
Show Gist options
  • Save lmazuel/4c53849248e5f11c9205b1f76fc1ba8a to your computer and use it in GitHub Desktop.
Save lmazuel/4c53849248e5f11c9205b1f76fc1ba8a to your computer and use it in GitHub Desktop.
import "@azure-tools/typespec-azure-core";
import "@typespec/http";
import "@typespec/rest";
import "@typespec/versioning";
using TypeSpec.Rest;
using TypeSpec.Http;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Traits;
@service({
title: "Azure App Configuration",
})
@versioned(Versions)
@useAuth(
ApiKeyAuth<ApiKeyLocation.header, "Connection String"> | OAuth2Auth<[
{
type: OAuth2FlowType.implicit,
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize",
scopes: ["https://azconfig.io/.default"],
}
]>
)
@server(
"{endpoint}",
"App Configuration service endpoint",
{
endpoint: url,
}
)
@doc("Azure App Configuration REST API")
namespace AzureAppConfiguration;
@doc("Service API versions")
enum Versions {
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
@doc("The 2023-11-01 API version")
v2023_11_01: "2023-11-01",
}
@doc("Key-value fields.")
union KeyValueFields {
@doc("Key field.")
key: "key",
@doc("Label field.")
label: "label",
@doc("Content type field.")
content_type: "content_type",
@doc("Value field.")
value: "value",
@doc("Last modified field.")
last_modified: "last_modified",
@doc("Tags field.")
tags: "tags",
@doc("Locked field.")
locked: "locked",
@doc("Etag field.")
etag: "etag",
string,
}
@doc("Snapshot fields.")
union SnapshotFields {
@doc("Name field.")
name: "name",
@doc("Status field.")
status: "status",
@doc("Filters field.")
filters: "filters",
@doc("Composition type field.")
composition_type: "composition_type",
@doc("Created field.")
created: "created",
@doc("Expires field.")
expires: "expires",
@doc("Retention period field.")
retention_period: "retention_period",
@doc("Size field.")
size: "size",
@doc("Items count field.")
items_count: "items_count",
@doc("Tags field.")
tags: "tags",
@doc("Etag field.")
etag: "etag",
string,
}
@doc("Snapshot status.")
union SnapshotStatus {
@doc("Provisioning")
provisioning: "provisioning",
@doc("Ready")
ready: "ready",
@doc("Archived")
archived: "archived",
@doc("Failed")
failed: "failed",
string,
}
@doc("Composition types.")
union CompositionType {
@doc("The 'key' composition type.")
key: "key",
@doc("The 'key_label' composition type.")
key_label: "key_label",
string,
}
@doc("Label fields.")
union LabelFields {
@doc("Name field.")
name: "name",
string,
}
@doc("The result of a list request.")
@pagedResult
model KeyListResult {
@doc("The collection value.")
@items
items?: Key[];
@doc("The URI that can be used to request the next set of paged results.")
@nextLink
`@nextLink`?: string;
}
@doc("Keys serve as identifiers for key-values and are used to store and retrieve corresponding values.")
@resource("keys")
model Key {
@doc("The name of the key.")
@key
@visibility("read")
name: string;
}
@doc("Azure App Configuration error object.")
@error
model Error {
@doc("The type of the error.")
type?: string;
@doc("A brief summary of the error.")
title?: string;
@doc("The name of the parameter that resulted in the error.")
name?: string;
@doc("A detailed description of the error.")
detail?: string;
@doc("The HTTP status code that the error maps to.")
status?: int32;
}
@doc("The result of a list request.")
@pagedResult
model KeyValueListResult {
@doc("The collection value.")
@items
items?: KeyValue[];
@doc("An identifier representing the returned state of the resource.")
etag?: string;
@doc("The URI that can be used to request the next set of paged results.")
@nextLink
`@nextLink`?: string;
}
@doc("A key-value pair representing application settings.")
@resource("kv")
model KeyValue {
@key
@visibility("read")
@doc("The key of the key-value.")
key: string;
@doc("The label the key-value belongs to.")
label?: string;
@doc("The content type of the value stored within the key-value.")
@encodedName("application/json", "content_type")
contentType?: string;
@doc("The value of the key-value.")
value?: string;
#suppress "@azure-tools/typespec-azure-core/no-offsetdatetime" "Pre-existing API contract."
@doc("A date representing the last time the key-value was modified.")
@encodedName("application/json", "last_modified")
lastModified?: offsetDateTime;
@doc("The tags of the key-value")
tags?: Record<string>;
@doc("Indicates whether the key-value is locked.")
locked?: boolean;
@doc("A value representing the current state of the resource.")
etag?: string;
}
@doc("The result of a snapshot list request.")
@pagedResult
model SnapshotListResult {
@doc("The collection value.")
@items
items?: Snapshot[];
@doc("The URI that can be used to request the next set of paged results.")
@nextLink
`@nextLink`?: string;
}
@doc("A snapshot is a named, immutable subset of an App Configuration store's key-values.")
@resource("snapshots")
model Snapshot {
@key
@doc("The name of the snapshot.")
@visibility("read")
name: string;
@doc("The current status of the snapshot.")
@visibility("read")
status?: SnapshotStatus;
@doc("A list of filters used to filter the key-values included in the snapshot.")
@minItems(1)
@maxItems(3)
filters: KeyValueFilter[];
@doc("""
The composition type describes how the key-values within the snapshot are
composed. The 'key' composition type ensures there are no two key-values
containing the same key. The 'key_label' composition type ensures there are no
two key-values containing the same key and label.
""")
@encodedName("application/json", "composition_type")
compositionType?: CompositionType;
#suppress "@azure-tools/typespec-azure-core/no-offsetdatetime" "Pre-existing API contract."
@doc("The time that the snapshot was created.")
@visibility("read")
created?: offsetDateTime;
#suppress "@azure-tools/typespec-azure-core/no-offsetdatetime" "Pre-existing API contract."
@doc("The time that the snapshot will expire.")
@visibility("read")
expires?: offsetDateTime;
@doc("""
The amount of time, in seconds, that a snapshot will remain in the archived
state before expiring. This property is only writable during the creation of a
snapshot. If not specified, the default lifetime of key-value revisions will be
used.
""")
@maxValue(7776000)
@minValue(3600)
@encodedName("application/json", "retention_period")
retentionPeriod?: int64;
@doc("The size in bytes of the snapshot.")
@visibility("read")
size?: int64;
@doc("The amount of key-values in the snapshot.")
@visibility("read")
@encodedName("application/json", "items_count")
itemsCount?: int64;
@doc("The tags of the snapshot.")
tags?: Record<string>;
@doc("A value representing the current state of the snapshot.")
@visibility("read")
etag?: string;
}
@doc("""
Enables filtering of key-values. Syntax reference:
https://aka.ms/azconfig/docs/restapisnapshots
""")
model KeyValueFilter {
@doc("Filters key-values by their key field.")
key: string;
@doc("Filters key-values by their label field.")
label?: string;
@doc("Filters key-values by their tags field.")
tags?: string[];
}
@doc("Parameters used to update a snapshot.")
model SnapshotUpdateParameters {
@doc("The desired status of the snapshot.")
status?: SnapshotStatus;
}
@doc("The result of a list request.")
@pagedResult
model LabelListResult {
@doc("The collection value.")
@items
items?: Label[];
@doc("The URI that can be used to request the next set of paged results.")
@nextLink
`@nextLink`?: string;
}
@doc("Labels are used to group key-values.")
model Label {
@doc("The name of the label.")
name?: string;
}
@doc("Details of a long running operation.")
model OperationDetails {
@doc("The unique id of the operation.")
id: string;
@doc("The current status of the operation")
status: Foundations.OperationState;
@doc("""
An error, available when the status is `Failed`, describing why the operation
failed.
""")
error?: Foundations.Error;
}
alias appConfigOperation<
TParams extends Reflection.Model,
TResponse,
Traits extends Reflection.Model = {},
TError = Error
> = Foundations.Operation<
TParams & ClientRequestIdHeader,
TResponse,
Traits,
TError
>;
alias standardOps = ResourceOperations<
SupportsClientRequestId & NoRepeatableRequests & NoConditionalRequests,
Error
>;
alias syncTokenHeader = {
@doc("Used to guarantee real-time consistency between requests.")
@header("Sync-Token")
syncToken?: string;
};
#suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Needs fix: https://github.com/microsoft/typespec/issues/2853"
alias contentTypeHeader<T extends string> = {
@doc("Content-Type header")
@header("Content-Type")
contentTypeHeader?: T | "application/problem+json";
};
alias AppConfigResponseHeaders = {
...syncTokenHeader;
@doc("A value representing the current state of the resource.")
@header("ETag")
etagHeader?: string;
};
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Gets a list of keys.")
@doc("Gets a list of keys.")
op getKeys is Foundations.ResourceList<
Key,
{
@doc("A filter for the name of the returned keys.")
@query("name")
name?: string;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
...syncTokenHeader;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
},
KeyListResult & {
...syncTokenHeader;
...contentTypeHeader<"application/vnd.microsoft.appconfig.keyset+json">;
},
{},
Error
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "No data-plane HEAD operation template"
@summary("Requests the headers and status of the given resource.")
@doc("Requests the headers and status of the given resource.")
@route("/keys")
@head
op checkKeys is appConfigOperation<
{
@doc("A filter for the name of the returned keys.")
@query("name")
name?: string;
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
},
OkResponse & {
...syncTokenHeader;
}
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Gets a list of key-values.")
@doc("Gets a list of key-values.")
op getKeyValues is Foundations.ResourceList<
KeyValue,
{
@doc("""
A filter used to match keys. Syntax reference:
https://aka.ms/azconfig/docs/keyvaluefiltering
""")
@query("key")
key?: string;
@doc("""
A filter used to match labels. Syntax reference:
https://aka.ms/azconfig/docs/keyvaluefiltering
""")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: KeyValueFields[];
@doc("""
A filter used get key-values for a snapshot. The value should be the name of
the snapshot. Not valid when used with 'key' and 'label' filters.
""")
@query("snapshot")
snapshot?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
#suppress "@azure-tools/typespec-azure-core/prefer-csv-collection-format" "Pre-existing API contract"
@doc("""
A filter used to query by tags. Syntax reference:
https://aka.ms/azconfig/docs/keyvaluefiltering
""")
@query({
name: "tags",
format: "multi",
})
tags?: string[];
},
KeyValueListResult &
AppConfigResponseHeaders &
contentTypeHeader<"application/vnd.microsoft.appconfig.kvset+json">,
{},
Error
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "No data-plane HEAD operation template"
@summary("Requests the headers and status of the given resource.")
@doc("Requests the headers and status of the given resource.")
@route("/kv")
@head
op checkKeyValues is appConfigOperation<
{
@doc("""
A filter used to match keys. Syntax reference:
https://aka.ms/azconfig/docs/keyvaluefiltering
""")
@query("key")
key?: string;
@doc("""
A filter used to match labels. Syntax reference:
https://aka.ms/azconfig/docs/keyvaluefiltering
""")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: KeyValueFields[];
@doc("A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters.")
@query("snapshot")
snapshot?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
#suppress "@azure-tools/typespec-azure-core/prefer-csv-collection-format" "Pre-existing API contract"
@doc("""
A filter used to query by tags. Syntax reference:
https://aka.ms/azconfig/docs/keyvaluefiltering
""")
@query({
name: "tags",
format: "multi",
})
tags?: string[];
},
OkResponse & AppConfigResponseHeaders
>;
@summary("Gets a single key-value.")
@doc("Gets a single key-value.")
op getKeyValue is standardOps.ResourceRead<
KeyValue,
QueryParametersTrait<{
@doc("The label of the key-value to retrieve.")
@query("label")
label?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: KeyValueFields[];
}> &
RequestHeadersTrait<{
...syncTokenHeader;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
}> &
ResponseHeadersTrait<AppConfigResponseHeaders &
contentTypeHeader<"application/vnd.microsoft.appconfig.kv+json">>
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Creates a key-value.")
@doc("Creates a key-value.")
@route("/kv/{key}")
@put
op putKeyValue is appConfigOperation<
{
#suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Needs fix: https://github.com/microsoft/typespec/issues/2853"
@doc("Content-Type header")
@header("Content-Type")
contentType:
| "application/vnd.microsoft.appconfig.kv+json"
| "application/vnd.microsoft.appconfig.kvset+json"
| "application/json"
| "text/json"
| "application/*+json"
| "application/json-patch+json";
@doc("The key of the key-value to create.")
@path
key: string;
@doc("The label of the key-value to create.")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
@doc("The key-value to create.")
@body
entity?: KeyValue;
},
KeyValue &
AppConfigResponseHeaders &
contentTypeHeader<"application/vnd.microsoft.appconfig.kv+json">
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Deletes a key-value.")
@doc("Deletes a key-value.")
@route("/kv/{key}")
@delete
op deleteKeyValue is appConfigOperation<
{
@doc("The key of the key-value to delete.")
@path
key: string;
@doc("The label of the key-value to delete.")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
},
(KeyValue &
AppConfigResponseHeaders &
contentTypeHeader<"application/vnd.microsoft.appconfig.kv+json">) | {
@statusCode
statusCode: 204;
...syncTokenHeader;
}
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "No data-plane HEAD operation template"
@summary("Requests the headers and status of the given resource.")
@doc("Requests the headers and status of the given resource.")
@route("/kv/{key}")
@head
op checkKeyValue is appConfigOperation<
{
@doc("The key of the key-value to retrieve.")
@path
key: string;
@doc("The label of the key-value to retrieve.")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: KeyValueFields[];
},
OkResponse & AppConfigResponseHeaders
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Gets a list of key-value snapshots.")
@doc("Gets a list of key-value snapshots.")
op getSnapshots is Foundations.ResourceList<
Snapshot,
{
@doc("A filter for the name of the returned snapshots.")
@query("name")
name?: string;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: SnapshotFields[];
@doc("Used to filter returned snapshots by their status property.")
@query({
name: "status",
format: "csv",
})
status?: SnapshotStatus[];
...syncTokenHeader;
},
SnapshotListResult & {
...syncTokenHeader;
...contentTypeHeader<"application/vnd.microsoft.appconfig.snapshotset+json">;
},
{},
Error
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "No data-plane HEAD operation template"
@summary("Requests the headers and status of the given resource.")
@doc("Requests the headers and status of the given resource.")
@route("/snapshots")
@head
op checkSnapshots is appConfigOperation<
{
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
},
OkResponse & {
...syncTokenHeader;
}
>;
@summary("Gets a single key-value snapshot.")
@doc("Gets a single key-value snapshot.")
op getSnapshot is standardOps.ResourceRead<
Snapshot,
QueryParametersTrait<{
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: SnapshotFields[];
}> &
RequestHeadersTrait<{
...syncTokenHeader;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
}> &
ResponseHeadersTrait<AppConfigResponseHeaders & {
@doc("Includes links to related resources.")
@header("Link")
link?: string;
...contentTypeHeader<"application/vnd.microsoft.appconfig.snapshot+json">;
}>
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Creates a key-value snapshot.")
@doc("Creates a key-value snapshot.")
@route("/snapshots/{name}")
@pollingOperation(getOperationDetails)
@put
op createSnapshot is Foundations.LongRunningOperation<
{
#suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Needs fix: https://github.com/microsoft/typespec/issues/2853"
@doc("Content-Type header")
@header("Content-Type")
@friendlyName("contentType")
contentTypeHeader: "application/vnd.microsoft.appconfig.snapshot+json" | "application/json";
@doc("The name of the key-value snapshot to create.")
@maxLength(256)
@path
name: string;
...syncTokenHeader;
@doc("The key-value snapshot to create.")
@body
entity: Snapshot;
},
CreatedResponse &
Snapshot & {
...AppConfigResponseHeaders;
@doc("Includes links to related resources.")
@header("Link")
link?: string;
...contentTypeHeader<"application/vnd.microsoft.appconfig.snapshot+json">;
},
{},
Error
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Updates the state of a key-value snapshot.")
@doc("Updates the state of a key-value snapshot.")
@route("/snapshots/{name}")
@patch
op updateSnapshot is appConfigOperation<
{
#suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Needs fix: https://github.com/microsoft/typespec/issues/2853"
@doc("Content-Type header")
@header("Content-Type")
@friendlyName("contentType")
contentTypeHeader: "application/merge-patch+json" | "application/json";
@doc("The name of the key-value snapshot to update.")
@path
name: string;
...syncTokenHeader;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
@doc("The parameters used to update the snapshot.")
@body
entity: SnapshotUpdateParameters;
},
Snapshot & {
...AppConfigResponseHeaders;
@doc("Includes links to related resources.")
@header("Link")
link?: string;
...contentTypeHeader<"application/vnd.microsoft.appconfig.snapshot+json">;
}
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "No data-plane HEAD operation template"
@summary("Requests the headers and status of the given resource.")
@doc("Requests the headers and status of the given resource.")
@route("/snapshots/{name}")
@head
op checkSnapshot is appConfigOperation<
{
@doc("The name of the key-value snapshot to check.")
@path
name: string;
...syncTokenHeader;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
},
OkResponse & {
...AppConfigResponseHeaders;
@doc("Includes links to related resources.")
@header("Link")
link?: string;
}
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Gets a list of labels.")
@doc("Gets a list of labels.")
@route("/labels")
op getLabels is appConfigOperation<
{
@doc("A filter for the name of the returned labels.")
@query("name")
name?: string;
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: LabelFields[];
},
LabelListResult & {
...syncTokenHeader;
...contentTypeHeader<"application/vnd.microsoft.appconfig.labelset+json">;
}
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "No data-plane HEAD operation template"
@summary("Requests the headers and status of the given resource.")
@doc("Requests the headers and status of the given resource.")
@route("/labels")
@head
op checkLabels is appConfigOperation<
{
@doc("A filter for the name of the returned labels.")
@query("name")
name?: string;
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: LabelFields[];
},
OkResponse & {
...syncTokenHeader;
}
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Locks a key-value.")
@doc("Locks a key-value.")
@route("/locks/{key}")
@put
op putLock is appConfigOperation<
{
@doc("The key of the key-value to lock.")
@path
key: string;
@doc("The label, if any, of the key-value to lock.")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
},
KeyValue &
AppConfigResponseHeaders &
contentTypeHeader<"application/vnd.microsoft.appconfig.kv+json">
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Unlocks a key-value.")
@doc("Unlocks a key-value.")
@route("/locks/{key}")
@delete
op deleteLock is appConfigOperation<
{
@doc("The key of the key-value to unlock.")
@path
key: string;
@doc("The label, if any, of the key-value to unlock.")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Used to perform an operation only if the targeted resource's etag matches the
value provided.
""")
@header("If-Match")
ifMatch?: string;
@doc("""
Used to perform an operation only if the targeted resource's etag does not
match the value provided.
""")
@header("If-None-Match")
ifNoneMatch?: string;
},
KeyValue &
AppConfigResponseHeaders &
contentTypeHeader<"application/vnd.microsoft.appconfig.kv+json">
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Gets a list of key-value revisions.")
@doc("Gets a list of key-value revisions.")
@route("/revisions")
@get
op getRevisions is appConfigOperation<
{
@doc("""
A filter used to match keys. Syntax reference:
https://aka.ms/azconfig/docs/restapirevisions
""")
@query("key")
key?: string;
@doc("""
A filter used to match labels. Syntax reference:
https://aka.ms/azconfig/docs/restapirevisions
""")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: KeyValueFields[];
#suppress "@azure-tools/typespec-azure-core/prefer-csv-collection-format" "Pre-existing API contract"
@doc("""
A filter used to query by tags. Syntax reference:
https://aka.ms/azconfig/docs/restapirevisions
""")
@query({
name: "tags",
format: "multi",
})
tags?: string[];
},
KeyValueListResult &
AppConfigResponseHeaders &
contentTypeHeader<"application/vnd.microsoft.appconfig.kvset+json">
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "No data-plane HEAD operation template"
@summary("Requests the headers and status of the given resource.")
@doc("Requests the headers and status of the given resource.")
@route("/revisions")
@head
op checkRevisions is appConfigOperation<
{
@doc("""
A filter used to match keys. Syntax reference:
https://aka.ms/azconfig/docs/restapirevisions
""")
@query("key")
key?: string;
@doc("""
A filter used to match labels. Syntax reference:
https://aka.ms/azconfig/docs/restapirevisions
""")
@query("label")
label?: string;
...syncTokenHeader;
@doc("""
Instructs the server to return elements that appear after the element referred
to by the specified token.
""")
@query("After")
after?: string;
@doc("""
Requests the server to respond with the state of the resource at the specified
time.
""")
@header("Accept-Datetime")
acceptDatetime?: string;
@doc("Used to select what fields are present in the returned resource(s).")
@query({
name: "$Select",
format: "csv",
})
select?: KeyValueFields[];
#suppress "@azure-tools/typespec-azure-core/prefer-csv-collection-format" "Pre-existing API contract"
@doc("""
A filter used to query by tags. Syntax reference:
https://aka.ms/azconfig/docs/restapirevisions
""")
@query({
name: "tags",
format: "multi",
})
tags?: string[];
},
OkResponse & AppConfigResponseHeaders
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Pre-existing API contract"
@summary("Gets the state of a long running operation.")
@doc("Gets the state of a long running operation.")
@route("/operations")
@get
op getOperationDetails is appConfigOperation<
{
@doc("Snapshot identifier for the long running operation.")
@query("snapshot")
snapshot: string;
},
OperationDetails
>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment