diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/Configuration.json b/sdk/appconfiguration/Azure.Data.AppConfiguration/Configuration.json new file mode 100644 index 000000000000..ede625681568 --- /dev/null +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/Configuration.json @@ -0,0 +1,12 @@ +{ + "output-folder": ".", + "namespace": "Azure.Data.AppConfiguration", + "library-name": "Azure.Data.AppConfiguration", + "flavor": "azure", + "use-model-reader-writer": true, + "shared-source-folders": [ + "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Generator.Shared", + "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Azure.Core.Shared" + ], + "model-namespace": false +} diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/autorest.md b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/autorest.md deleted file mode 100644 index af1f2ccf84c9..000000000000 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/autorest.md +++ /dev/null @@ -1,55 +0,0 @@ -# Azure SDK Code Generation for Data Plane - -Run `dotnet build /t:GenerateCode` to generate code. - -### AutoRest Configuration -> see https://aka.ms/autorest -``` yaml -input-file: -- https://github.com/Azure/azure-rest-api-specs/blob/c1af3ab8e803da2f40fc90217a6d023bc13b677f/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-11-01/appconfiguration.json -namespace: Azure.Data.AppConfiguration -title: ConfigurationClient -``` - -### Change Endpoint type to Uri -``` yaml -directive: - from: swagger-document - where: $.parameters.Endpoint - transform: $.format = "url" - ``` - -### Modify operation names -``` yaml -directive: -- rename-operation: - from: PutKeyValue - to: SetConfigurationSetting -- rename-operation: - from: DeleteKeyValue - to: DeleteConfigurationSetting -- rename-operation: - from: GetKeyValue - to: GetConfigurationSetting -- rename-operation: - from: GetKeyValues - to: GetConfigurationSettings -- rename-operation: - from: PutLock - to: CreateReadOnlyLock -- rename-operation: - from: DeleteLock - to: DeleteReadOnlyLock -- rename-operation: - from: UpdateSnapshot - to: UpdateSnapshotStatus -``` - -### Internalize protocol methods -``` yaml -directive: - from: swagger-document - where: $.paths.*.* - transform: > - $["x-accessibility"] = "internal" -``` diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/tsp-location.yaml b/sdk/appconfiguration/Azure.Data.AppConfiguration/tsp-location.yaml new file mode 100644 index 000000000000..9c751341cd63 --- /dev/null +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/appconfiguration/AppConfiguration +commit: f79d4ed573ec12a63917b01e54baeaa52a914f3f +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/tspCodeModel.json b/sdk/appconfiguration/Azure.Data.AppConfiguration/tspCodeModel.json new file mode 100644 index 000000000000..df3af1fa77a0 --- /dev/null +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/tspCodeModel.json @@ -0,0 +1,17360 @@ +{ + "$id": "1", + "name": "AzureAppConfiguration", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "enums": [ + { + "$id": "2", + "kind": "enum", + "name": "GetKeysResponseContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeys.ResponseContentType.anonymous", + "valueType": { + "$id": "3", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "4", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.keyset+json", + "value": "application/vnd.microsoft.appconfig.keyset+json", + "valueType": { + "$id": "5", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "2" + }, + "decorators": [] + }, + { + "$id": "6", + "kind": "enumvalue", + "name": "application/problem+json", + "value": "application/problem+json", + "valueType": { + "$id": "7", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "2" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Output", + "decorators": [] + }, + { + "$id": "8", + "kind": "enum", + "name": "KeyValueFields", + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueFields", + "valueType": { + "$id": "9", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "10", + "kind": "enumvalue", + "name": "key", + "value": "key", + "valueType": { + "$id": "11", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Key field.", + "decorators": [] + }, + { + "$id": "12", + "kind": "enumvalue", + "name": "label", + "value": "label", + "valueType": { + "$id": "13", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Label field.", + "decorators": [] + }, + { + "$id": "14", + "kind": "enumvalue", + "name": "content_type", + "value": "content_type", + "valueType": { + "$id": "15", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Content type field.", + "decorators": [] + }, + { + "$id": "16", + "kind": "enumvalue", + "name": "value", + "value": "value", + "valueType": { + "$id": "17", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Value field.", + "decorators": [] + }, + { + "$id": "18", + "kind": "enumvalue", + "name": "last_modified", + "value": "last_modified", + "valueType": { + "$id": "19", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Last modified field.", + "decorators": [] + }, + { + "$id": "20", + "kind": "enumvalue", + "name": "tags", + "value": "tags", + "valueType": { + "$id": "21", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Tags field.", + "decorators": [] + }, + { + "$id": "22", + "kind": "enumvalue", + "name": "locked", + "value": "locked", + "valueType": { + "$id": "23", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Locked field.", + "decorators": [] + }, + { + "$id": "24", + "kind": "enumvalue", + "name": "etag", + "value": "etag", + "valueType": { + "$id": "25", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "8" + }, + "doc": "Etag field.", + "decorators": [] + } + ], + "namespace": "Azure.Data.AppConfiguration", + "doc": "Key-value fields.", + "isFixed": false, + "isFlags": false, + "usage": "Input", + "decorators": [] + }, + { + "$id": "26", + "kind": "enum", + "name": "GetKeyValuesResponseContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeyValues.ResponseContentType.anonymous", + "valueType": { + "$id": "27", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "28", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.kvset+json", + "value": "application/vnd.microsoft.appconfig.kvset+json", + "valueType": { + "$id": "29", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "26" + }, + "decorators": [] + }, + { + "$id": "30", + "kind": "enumvalue", + "name": "application/problem+json", + "value": "application/problem+json", + "valueType": { + "$id": "31", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "26" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Output", + "decorators": [] + }, + { + "$id": "32", + "kind": "enum", + "name": "GetKeyValueResponseContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeyValue.ResponseContentType.anonymous", + "valueType": { + "$id": "33", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "34", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.kv+json", + "value": "application/vnd.microsoft.appconfig.kv+json", + "valueType": { + "$id": "35", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "32" + }, + "decorators": [] + }, + { + "$id": "36", + "kind": "enumvalue", + "name": "application/problem+json", + "value": "application/problem+json", + "valueType": { + "$id": "37", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "32" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Output", + "decorators": [] + }, + { + "$id": "38", + "kind": "enum", + "name": "PutKeyValueRequestContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.putKeyValue.RequestContentType.anonymous", + "valueType": { + "$id": "39", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "40", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.kv+json", + "value": "application/vnd.microsoft.appconfig.kv+json", + "valueType": { + "$id": "41", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + }, + { + "$id": "42", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.kvset+json", + "value": "application/vnd.microsoft.appconfig.kvset+json", + "valueType": { + "$id": "43", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + }, + { + "$id": "44", + "kind": "enumvalue", + "name": "application/json", + "value": "application/json", + "valueType": { + "$id": "45", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + }, + { + "$id": "46", + "kind": "enumvalue", + "name": "text/json", + "value": "text/json", + "valueType": { + "$id": "47", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + }, + { + "$id": "48", + "kind": "enumvalue", + "name": "application/*+json", + "value": "application/*+json", + "valueType": { + "$id": "49", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + }, + { + "$id": "50", + "kind": "enumvalue", + "name": "application/json-patch+json", + "value": "application/json-patch+json", + "valueType": { + "$id": "51", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "38" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Input", + "decorators": [] + }, + { + "$id": "52", + "kind": "enum", + "name": "SnapshotFields", + "crossLanguageDefinitionId": "AzureAppConfiguration.SnapshotFields", + "valueType": { + "$id": "53", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "54", + "kind": "enumvalue", + "name": "name", + "value": "name", + "valueType": { + "$id": "55", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Name field.", + "decorators": [] + }, + { + "$id": "56", + "kind": "enumvalue", + "name": "status", + "value": "status", + "valueType": { + "$id": "57", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Status field.", + "decorators": [] + }, + { + "$id": "58", + "kind": "enumvalue", + "name": "filters", + "value": "filters", + "valueType": { + "$id": "59", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Filters field.", + "decorators": [] + }, + { + "$id": "60", + "kind": "enumvalue", + "name": "composition_type", + "value": "composition_type", + "valueType": { + "$id": "61", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Composition type field.", + "decorators": [] + }, + { + "$id": "62", + "kind": "enumvalue", + "name": "created", + "value": "created", + "valueType": { + "$id": "63", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Created field.", + "decorators": [] + }, + { + "$id": "64", + "kind": "enumvalue", + "name": "expires", + "value": "expires", + "valueType": { + "$id": "65", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Expires field.", + "decorators": [] + }, + { + "$id": "66", + "kind": "enumvalue", + "name": "retention_period", + "value": "retention_period", + "valueType": { + "$id": "67", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Retention period field.", + "decorators": [] + }, + { + "$id": "68", + "kind": "enumvalue", + "name": "size", + "value": "size", + "valueType": { + "$id": "69", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Size field.", + "decorators": [] + }, + { + "$id": "70", + "kind": "enumvalue", + "name": "items_count", + "value": "items_count", + "valueType": { + "$id": "71", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Items count field.", + "decorators": [] + }, + { + "$id": "72", + "kind": "enumvalue", + "name": "tags", + "value": "tags", + "valueType": { + "$id": "73", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Tags field.", + "decorators": [] + }, + { + "$id": "74", + "kind": "enumvalue", + "name": "etag", + "value": "etag", + "valueType": { + "$id": "75", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "52" + }, + "doc": "Etag field.", + "decorators": [] + } + ], + "namespace": "Azure.Data.AppConfiguration", + "doc": "Snapshot fields.", + "isFixed": false, + "isFlags": false, + "usage": "Input", + "decorators": [] + }, + { + "$id": "76", + "kind": "enum", + "name": "SnapshotStatus", + "crossLanguageDefinitionId": "AzureAppConfiguration.SnapshotStatus", + "valueType": { + "$id": "77", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "78", + "kind": "enumvalue", + "name": "provisioning", + "value": "provisioning", + "valueType": { + "$id": "79", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "76" + }, + "doc": "Provisioning", + "decorators": [] + }, + { + "$id": "80", + "kind": "enumvalue", + "name": "ready", + "value": "ready", + "valueType": { + "$id": "81", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "76" + }, + "doc": "Ready", + "decorators": [] + }, + { + "$id": "82", + "kind": "enumvalue", + "name": "archived", + "value": "archived", + "valueType": { + "$id": "83", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "76" + }, + "doc": "Archived", + "decorators": [] + }, + { + "$id": "84", + "kind": "enumvalue", + "name": "failed", + "value": "failed", + "valueType": { + "$id": "85", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "76" + }, + "doc": "Failed", + "decorators": [] + } + ], + "namespace": "Azure.Data.AppConfiguration", + "doc": "Snapshot status.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,JsonMergePatch,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "86", + "kind": "enum", + "name": "CompositionType", + "crossLanguageDefinitionId": "AzureAppConfiguration.CompositionType", + "valueType": { + "$id": "87", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "88", + "kind": "enumvalue", + "name": "key", + "value": "key", + "valueType": { + "$id": "89", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "86" + }, + "doc": "The 'key' composition type.", + "decorators": [] + }, + { + "$id": "90", + "kind": "enumvalue", + "name": "key_label", + "value": "key_label", + "valueType": { + "$id": "91", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "86" + }, + "doc": "The 'key_label' composition type.", + "decorators": [] + } + ], + "namespace": "Azure.Data.AppConfiguration", + "doc": "Composition types.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "92", + "kind": "enum", + "name": "GetSnapshotsResponseContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.getSnapshots.ResponseContentType.anonymous", + "valueType": { + "$id": "93", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "94", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.snapshotset+json", + "value": "application/vnd.microsoft.appconfig.snapshotset+json", + "valueType": { + "$id": "95", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "92" + }, + "decorators": [] + }, + { + "$id": "96", + "kind": "enumvalue", + "name": "application/problem+json", + "value": "application/problem+json", + "valueType": { + "$id": "97", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "92" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Output", + "decorators": [] + }, + { + "$id": "98", + "kind": "enum", + "name": "GetSnapshotResponseContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.getSnapshot.ResponseContentType.anonymous", + "valueType": { + "$id": "99", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "100", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.snapshot+json", + "value": "application/vnd.microsoft.appconfig.snapshot+json", + "valueType": { + "$id": "101", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "98" + }, + "decorators": [] + }, + { + "$id": "102", + "kind": "enumvalue", + "name": "application/problem+json", + "value": "application/problem+json", + "valueType": { + "$id": "103", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "98" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Output", + "decorators": [] + }, + { + "$id": "104", + "kind": "enum", + "name": "OperationState", + "crossLanguageDefinitionId": "Azure.Core.Foundations.OperationState", + "valueType": { + "$id": "105", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "106", + "kind": "enumvalue", + "name": "NotStarted", + "value": "NotStarted", + "valueType": { + "$id": "107", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "104" + }, + "doc": "The operation has not started.", + "decorators": [] + }, + { + "$id": "108", + "kind": "enumvalue", + "name": "Running", + "value": "Running", + "valueType": { + "$id": "109", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "104" + }, + "doc": "The operation is in progress.", + "decorators": [] + }, + { + "$id": "110", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$id": "111", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "104" + }, + "doc": "The operation has completed successfully.", + "decorators": [] + }, + { + "$id": "112", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$id": "113", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "104" + }, + "doc": "The operation has failed.", + "decorators": [] + }, + { + "$id": "114", + "kind": "enumvalue", + "name": "Canceled", + "value": "Canceled", + "valueType": { + "$id": "115", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "104" + }, + "doc": "The operation has been canceled by the user.", + "decorators": [] + } + ], + "namespace": "Azure.Data.AppConfiguration", + "doc": "Enum describing allowed operation states.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroPolling", + "decorators": [] + }, + { + "$id": "116", + "kind": "enum", + "name": "CreateSnapshotRequestContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.createSnapshot.RequestContentType.anonymous", + "valueType": { + "$id": "117", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "118", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.snapshot+json", + "value": "application/vnd.microsoft.appconfig.snapshot+json", + "valueType": { + "$id": "119", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "116" + }, + "decorators": [] + }, + { + "$id": "120", + "kind": "enumvalue", + "name": "application/json", + "value": "application/json", + "valueType": { + "$id": "121", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "116" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Input", + "decorators": [] + }, + { + "$id": "122", + "kind": "enum", + "name": "UpdateSnapshotRequestContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.updateSnapshot.RequestContentType.anonymous", + "valueType": { + "$id": "123", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "124", + "kind": "enumvalue", + "name": "application/merge-patch+json", + "value": "application/merge-patch+json", + "valueType": { + "$id": "125", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "122" + }, + "decorators": [] + }, + { + "$id": "126", + "kind": "enumvalue", + "name": "application/json", + "value": "application/json", + "valueType": { + "$id": "127", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "122" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Input", + "decorators": [] + }, + { + "$id": "128", + "kind": "enum", + "name": "LabelFields", + "crossLanguageDefinitionId": "AzureAppConfiguration.LabelFields", + "valueType": { + "$id": "129", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "130", + "kind": "enumvalue", + "name": "name", + "value": "name", + "valueType": { + "$id": "131", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "128" + }, + "doc": "Name field.", + "decorators": [] + } + ], + "namespace": "Azure.Data.AppConfiguration", + "doc": "Label fields.", + "isFixed": false, + "isFlags": false, + "usage": "Input", + "decorators": [] + }, + { + "$id": "132", + "kind": "enum", + "name": "GetLabelsResponseContentType", + "crossLanguageDefinitionId": "AzureAppConfiguration.getLabels.ResponseContentType.anonymous", + "valueType": { + "$id": "133", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "134", + "kind": "enumvalue", + "name": "application/vnd.microsoft.appconfig.labelset+json", + "value": "application/vnd.microsoft.appconfig.labelset+json", + "valueType": { + "$id": "135", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "132" + }, + "decorators": [] + }, + { + "$id": "136", + "kind": "enumvalue", + "name": "application/problem+json", + "value": "application/problem+json", + "valueType": { + "$id": "137", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "132" + }, + "decorators": [] + } + ], + "namespace": "", + "isFixed": true, + "isFlags": false, + "usage": "Output", + "decorators": [] + }, + { + "$id": "138", + "kind": "enum", + "name": "Versions", + "crossLanguageDefinitionId": "AzureAppConfiguration.Versions", + "valueType": { + "$id": "139", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "140", + "kind": "enumvalue", + "name": "v2023_11_01", + "value": "2023-11-01", + "valueType": { + "$id": "141", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "138" + }, + "doc": "The 2023-11-01 API version", + "decorators": [] + }, + { + "$id": "142", + "kind": "enumvalue", + "name": "v2024_09_01", + "value": "2024-09-01", + "valueType": { + "$id": "143", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "138" + }, + "doc": "The 2024-09-01 API version", + "decorators": [] + } + ], + "namespace": "Azure.Data.AppConfiguration", + "doc": "Service API versions", + "isFixed": true, + "isFlags": false, + "usage": "ApiVersionEnum", + "decorators": [] + } + ], + "models": [ + { + "$id": "144", + "kind": "model", + "name": "KeyListResult", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyListResult", + "usage": "Output,Json", + "doc": "The result of a list request.", + "decorators": [], + "properties": [ + { + "$id": "145", + "kind": "property", + "name": "items", + "serializedName": "items", + "doc": "The collection value.", + "type": { + "$id": "146", + "kind": "array", + "name": "ArrayKey", + "valueType": { + "$id": "147", + "kind": "model", + "name": "Key", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.Key", + "usage": "Output,Json", + "doc": "Keys serve as identifiers for key-values and are used to store and retrieve corresponding values.", + "decorators": [], + "properties": [ + { + "$id": "148", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the key.", + "type": { + "$id": "149", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Key.name", + "serializationOptions": { + "$id": "150", + "json": { + "$id": "151", + "name": "name" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyListResult.items", + "serializationOptions": { + "$id": "152", + "json": { + "$id": "153", + "name": "items" + } + } + }, + { + "$id": "154", + "kind": "property", + "name": "@nextLink", + "serializedName": "@nextLink", + "doc": "The URI that can be used to request the next set of paged results.", + "type": { + "$id": "155", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyListResult.@nextLink", + "serializationOptions": { + "$id": "156", + "json": { + "$id": "157", + "name": "@nextLink" + } + } + } + ] + }, + { + "$ref": "147" + }, + { + "$id": "158", + "kind": "model", + "name": "Error", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.Error", + "usage": "Json,Exception", + "doc": "Azure App Configuration error object.", + "decorators": [], + "properties": [ + { + "$id": "159", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "The type of the error.", + "type": { + "$id": "160", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Error.type", + "serializationOptions": { + "$id": "161", + "json": { + "$id": "162", + "name": "type" + } + } + }, + { + "$id": "163", + "kind": "property", + "name": "title", + "serializedName": "title", + "doc": "A brief summary of the error.", + "type": { + "$id": "164", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Error.title", + "serializationOptions": { + "$id": "165", + "json": { + "$id": "166", + "name": "title" + } + } + }, + { + "$id": "167", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the parameter that resulted in the error.", + "type": { + "$id": "168", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Error.name", + "serializationOptions": { + "$id": "169", + "json": { + "$id": "170", + "name": "name" + } + } + }, + { + "$id": "171", + "kind": "property", + "name": "detail", + "serializedName": "detail", + "doc": "A detailed description of the error.", + "type": { + "$id": "172", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Error.detail", + "serializationOptions": { + "$id": "173", + "json": { + "$id": "174", + "name": "detail" + } + } + }, + { + "$id": "175", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "The HTTP status code that the error maps to.", + "type": { + "$id": "176", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Error.status", + "serializationOptions": { + "$id": "177", + "json": { + "$id": "178", + "name": "status" + } + } + } + ] + }, + { + "$id": "179", + "kind": "model", + "name": "KeyValueListResult", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueListResult", + "usage": "Output,Json", + "doc": "The result of a list request.", + "decorators": [], + "properties": [ + { + "$id": "180", + "kind": "property", + "name": "items", + "serializedName": "items", + "doc": "The collection value.", + "type": { + "$id": "181", + "kind": "array", + "name": "ArrayKeyValue", + "valueType": { + "$id": "182", + "kind": "model", + "name": "KeyValue", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue", + "usage": "Input,Output,Json", + "doc": "A key-value pair representing application settings.", + "decorators": [], + "properties": [ + { + "$id": "183", + "kind": "property", + "name": "key", + "serializedName": "key", + "doc": "The key of the key-value.", + "type": { + "$id": "184", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.key", + "serializationOptions": { + "$id": "185", + "json": { + "$id": "186", + "name": "key" + } + } + }, + { + "$id": "187", + "kind": "property", + "name": "label", + "serializedName": "label", + "doc": "The label the key-value belongs to.", + "type": { + "$id": "188", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.label", + "serializationOptions": { + "$id": "189", + "json": { + "$id": "190", + "name": "label" + } + } + }, + { + "$id": "191", + "kind": "property", + "name": "contentType", + "serializedName": "content_type", + "doc": "The content type of the value stored within the key-value.", + "type": { + "$id": "192", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.contentType", + "serializationOptions": { + "$id": "193", + "json": { + "$id": "194", + "name": "content_type" + } + } + }, + { + "$id": "195", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The value of the key-value.", + "type": { + "$id": "196", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.value", + "serializationOptions": { + "$id": "197", + "json": { + "$id": "198", + "name": "value" + } + } + }, + { + "$id": "199", + "kind": "property", + "name": "lastModified", + "serializedName": "last_modified", + "doc": "A date representing the last time the key-value was modified.", + "type": { + "$id": "200", + "kind": "offsetDateTime", + "name": "offsetDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "201", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.offsetDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.lastModified", + "serializationOptions": { + "$id": "202", + "json": { + "$id": "203", + "name": "last_modified" + } + } + }, + { + "$id": "204", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "The tags of the key-value", + "type": { + "$id": "205", + "kind": "dict", + "keyType": { + "$id": "206", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "valueType": { + "$id": "207", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.tags", + "serializationOptions": { + "$id": "208", + "json": { + "$id": "209", + "name": "tags" + } + } + }, + { + "$id": "210", + "kind": "property", + "name": "locked", + "serializedName": "locked", + "doc": "Indicates whether the key-value is locked.", + "type": { + "$id": "211", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.locked", + "serializationOptions": { + "$id": "212", + "json": { + "$id": "213", + "name": "locked" + } + } + }, + { + "$id": "214", + "kind": "property", + "name": "etag", + "serializedName": "etag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "215", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValue.etag", + "serializationOptions": { + "$id": "216", + "json": { + "$id": "217", + "name": "etag" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueListResult.items", + "serializationOptions": { + "$id": "218", + "json": { + "$id": "219", + "name": "items" + } + } + }, + { + "$id": "220", + "kind": "property", + "name": "etag", + "serializedName": "etag", + "doc": "An identifier representing the returned state of the resource.", + "type": { + "$id": "221", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueListResult.etag", + "serializationOptions": { + "$id": "222", + "json": { + "$id": "223", + "name": "etag" + } + } + }, + { + "$id": "224", + "kind": "property", + "name": "@nextLink", + "serializedName": "@nextLink", + "doc": "The URI that can be used to request the next set of paged results.", + "type": { + "$id": "225", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueListResult.@nextLink", + "serializationOptions": { + "$id": "226", + "json": { + "$id": "227", + "name": "@nextLink" + } + } + } + ] + }, + { + "$ref": "182" + }, + { + "$id": "228", + "kind": "model", + "name": "SnapshotListResult", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.SnapshotListResult", + "usage": "Output,Json", + "doc": "The result of a snapshot list request.", + "decorators": [], + "properties": [ + { + "$id": "229", + "kind": "property", + "name": "items", + "serializedName": "items", + "doc": "The collection value.", + "type": { + "$id": "230", + "kind": "array", + "name": "ArraySnapshot", + "valueType": { + "$id": "231", + "kind": "model", + "name": "Snapshot", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A snapshot is a named, immutable subset of an App Configuration store's key-values.", + "decorators": [], + "properties": [ + { + "$id": "232", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the snapshot.", + "type": { + "$id": "233", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.name", + "serializationOptions": { + "$id": "234", + "json": { + "$id": "235", + "name": "name" + } + } + }, + { + "$id": "236", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "The current status of the snapshot.", + "type": { + "$ref": "76" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.status", + "serializationOptions": { + "$id": "237", + "json": { + "$id": "238", + "name": "status" + } + } + }, + { + "$id": "239", + "kind": "property", + "name": "filters", + "serializedName": "filters", + "doc": "A list of filters used to filter the key-values included in the snapshot.", + "type": { + "$id": "240", + "kind": "array", + "name": "ArrayKeyValueFilter", + "valueType": { + "$id": "241", + "kind": "model", + "name": "KeyValueFilter", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueFilter", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Enables filtering of key-values. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapisnapshots", + "decorators": [], + "properties": [ + { + "$id": "242", + "kind": "property", + "name": "key", + "serializedName": "key", + "doc": "Filters key-values by their key field.", + "type": { + "$id": "243", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueFilter.key", + "serializationOptions": { + "$id": "244", + "json": { + "$id": "245", + "name": "key" + } + } + }, + { + "$id": "246", + "kind": "property", + "name": "label", + "serializedName": "label", + "doc": "Filters key-values by their label field.", + "type": { + "$id": "247", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueFilter.label", + "serializationOptions": { + "$id": "248", + "json": { + "$id": "249", + "name": "label" + } + } + }, + { + "$id": "250", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Filters key-values by their tags field.", + "type": { + "$id": "251", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "252", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.KeyValueFilter.tags", + "serializationOptions": { + "$id": "253", + "json": { + "$id": "254", + "name": "tags" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.filters", + "serializationOptions": { + "$id": "255", + "json": { + "$id": "256", + "name": "filters" + } + } + }, + { + "$id": "257", + "kind": "property", + "name": "compositionType", + "serializedName": "composition_type", + "doc": "The composition type describes how the key-values within the snapshot are\ncomposed. The 'key' composition type ensures there are no two key-values\ncontaining the same key. The 'key_label' composition type ensures there are no\ntwo key-values containing the same key and label.", + "type": { + "$ref": "86" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.compositionType", + "serializationOptions": { + "$id": "258", + "json": { + "$id": "259", + "name": "composition_type" + } + } + }, + { + "$id": "260", + "kind": "property", + "name": "created", + "serializedName": "created", + "doc": "The time that the snapshot was created.", + "type": { + "$id": "261", + "kind": "offsetDateTime", + "name": "offsetDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "262", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.offsetDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.created", + "serializationOptions": { + "$id": "263", + "json": { + "$id": "264", + "name": "created" + } + } + }, + { + "$id": "265", + "kind": "property", + "name": "expires", + "serializedName": "expires", + "doc": "The time that the snapshot will expire.", + "type": { + "$id": "266", + "kind": "offsetDateTime", + "name": "offsetDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "267", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.offsetDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.expires", + "serializationOptions": { + "$id": "268", + "json": { + "$id": "269", + "name": "expires" + } + } + }, + { + "$id": "270", + "kind": "property", + "name": "retentionPeriod", + "serializedName": "retention_period", + "doc": "The amount of time, in seconds, that a snapshot will remain in the archived\nstate before expiring. This property is only writable during the creation of a\nsnapshot. If not specified, the default lifetime of key-value revisions will be\nused.", + "type": { + "$id": "271", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.retentionPeriod", + "serializationOptions": { + "$id": "272", + "json": { + "$id": "273", + "name": "retention_period" + } + } + }, + { + "$id": "274", + "kind": "property", + "name": "size", + "serializedName": "size", + "doc": "The size in bytes of the snapshot.", + "type": { + "$id": "275", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.size", + "serializationOptions": { + "$id": "276", + "json": { + "$id": "277", + "name": "size" + } + } + }, + { + "$id": "278", + "kind": "property", + "name": "itemsCount", + "serializedName": "items_count", + "doc": "The amount of key-values in the snapshot.", + "type": { + "$id": "279", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.itemsCount", + "serializationOptions": { + "$id": "280", + "json": { + "$id": "281", + "name": "items_count" + } + } + }, + { + "$id": "282", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "The tags of the snapshot.", + "type": { + "$id": "283", + "kind": "dict", + "keyType": { + "$id": "284", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "valueType": { + "$id": "285", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.tags", + "serializationOptions": { + "$id": "286", + "json": { + "$id": "287", + "name": "tags" + } + } + }, + { + "$id": "288", + "kind": "property", + "name": "etag", + "serializedName": "etag", + "doc": "A value representing the current state of the snapshot.", + "type": { + "$id": "289", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Snapshot.etag", + "serializationOptions": { + "$id": "290", + "json": { + "$id": "291", + "name": "etag" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.SnapshotListResult.items", + "serializationOptions": { + "$id": "292", + "json": { + "$id": "293", + "name": "items" + } + } + }, + { + "$id": "294", + "kind": "property", + "name": "@nextLink", + "serializedName": "@nextLink", + "doc": "The URI that can be used to request the next set of paged results.", + "type": { + "$id": "295", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.SnapshotListResult.@nextLink", + "serializationOptions": { + "$id": "296", + "json": { + "$id": "297", + "name": "@nextLink" + } + } + } + ] + }, + { + "$ref": "231" + }, + { + "$ref": "241" + }, + { + "$id": "298", + "kind": "model", + "name": "OperationDetails", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.OperationDetails", + "usage": "Output,Json,LroPolling", + "doc": "Details of a long running operation.", + "decorators": [], + "properties": [ + { + "$id": "299", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "The unique id of the operation.", + "type": { + "$id": "300", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.OperationDetails.id", + "serializationOptions": { + "$id": "301", + "json": { + "$id": "302", + "name": "id" + } + } + }, + { + "$id": "303", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "The current status of the operation", + "type": { + "$ref": "104" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.OperationDetails.status", + "serializationOptions": { + "$id": "304", + "json": { + "$id": "305", + "name": "status" + } + } + }, + { + "$id": "306", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "An error, available when the status is `Failed`, describing why the operation\nfailed.", + "type": { + "$ref": "158" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.OperationDetails.error", + "serializationOptions": { + "$id": "307", + "json": { + "$id": "308", + "name": "error" + } + } + } + ] + }, + { + "$id": "309", + "kind": "model", + "name": "SnapshotUpdateParameters", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.SnapshotUpdateParameters", + "usage": "Input,JsonMergePatch,Json", + "doc": "Parameters used to update a snapshot.", + "decorators": [], + "properties": [ + { + "$id": "310", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "The desired status of the snapshot.", + "type": { + "$ref": "76" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.SnapshotUpdateParameters.status", + "serializationOptions": { + "$id": "311", + "json": { + "$id": "312", + "name": "status" + } + } + } + ] + }, + { + "$id": "313", + "kind": "model", + "name": "LabelListResult", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.LabelListResult", + "usage": "Output,Json", + "doc": "The result of a list request.", + "decorators": [], + "properties": [ + { + "$id": "314", + "kind": "property", + "name": "items", + "serializedName": "items", + "doc": "The collection value.", + "type": { + "$id": "315", + "kind": "array", + "name": "ArrayLabel", + "valueType": { + "$id": "316", + "kind": "model", + "name": "Label", + "namespace": "Azure.Data.AppConfiguration", + "crossLanguageDefinitionId": "AzureAppConfiguration.Label", + "usage": "Output,Json", + "doc": "Labels are used to group key-values.", + "decorators": [], + "properties": [ + { + "$id": "317", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the label.", + "type": { + "$id": "318", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.Label.name", + "serializationOptions": { + "$id": "319", + "json": { + "$id": "320", + "name": "name" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.LabelListResult.items", + "serializationOptions": { + "$id": "321", + "json": { + "$id": "322", + "name": "items" + } + } + }, + { + "$id": "323", + "kind": "property", + "name": "@nextLink", + "serializedName": "@nextLink", + "doc": "The URI that can be used to request the next set of paged results.", + "type": { + "$id": "324", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "AzureAppConfiguration.LabelListResult.@nextLink", + "serializationOptions": { + "$id": "325", + "json": { + "$id": "326", + "name": "@nextLink" + } + } + } + ] + }, + { + "$ref": "316" + } + ], + "clients": [ + { + "$id": "327", + "kind": "client", + "name": "AzureAppConfigurationClient", + "namespace": "Azure.Data.AppConfiguration", + "doc": "Azure App Configuration REST API", + "methods": [ + { + "$id": "328", + "kind": "paging", + "name": "getKeys", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets a list of keys.", + "summary": "Gets a list of keys.", + "operation": { + "$id": "329", + "name": "getKeys", + "resourceName": "Key", + "summary": "Gets a list of keys.", + "doc": "Gets a list of keys.", + "accessibility": "public", + "parameters": [ + { + "$id": "330", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "331", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "332", + "type": { + "$id": "333", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "334", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned keys.", + "type": { + "$id": "335", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "336", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "337", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "338", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "339", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "340", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "341", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "342", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "343", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "344", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "144" + }, + "headers": [ + { + "$id": "345", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "346", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "347", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "2" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.keyset+json", + "application/problem+json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/keys", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeys", + "decorators": [], + "examples": [ + { + "$id": "348", + "kind": "http", + "name": "Gets a list of keys.", + "description": "Gets a list of keys.", + "filePath": "2024-09-01/GetKeys.json", + "parameters": [ + { + "$id": "349", + "parameter": { + "$ref": "330" + }, + "value": { + "$id": "350", + "kind": "string", + "type": { + "$ref": "331" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "351", + "response": { + "$ref": "344" + }, + "statusCode": 200, + "bodyValue": { + "$id": "352", + "kind": "model", + "type": { + "$ref": "144" + }, + "value": { + "$id": "353", + "items": { + "$id": "354", + "kind": "array", + "type": { + "$ref": "146" + }, + "value": [ + { + "$id": "355", + "kind": "model", + "type": { + "$ref": "147" + }, + "value": { + "$id": "356", + "name": { + "$id": "357", + "kind": "string", + "type": { + "$ref": "149" + }, + "value": "MaxRequests" + } + } + }, + { + "$id": "358", + "kind": "model", + "type": { + "$ref": "147" + }, + "value": { + "$id": "359", + "name": { + "$id": "360", + "kind": "string", + "type": { + "$ref": "149" + }, + "value": "RequestTimeout" + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "361", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned keys.", + "type": { + "$id": "362", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "363", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "364", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "365", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "366", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "367", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "368", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "369", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "343" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "370", + "type": { + "$id": "371", + "kind": "array", + "name": "ArrayKey", + "valueType": { + "$ref": "147" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "resultSegments": [ + "items" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeys", + "pagingMetadata": { + "$id": "372", + "itemPropertySegments": [ + "items" + ], + "nextLink": { + "$id": "373", + "responseSegments": [ + "@nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "374", + "kind": "basic", + "name": "checkKeys", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Requests the headers and status of the given resource.", + "summary": "Requests the headers and status of the given resource.", + "operation": { + "$id": "375", + "name": "checkKeys", + "resourceName": "AzureAppConfiguration", + "summary": "Requests the headers and status of the given resource.", + "doc": "Requests the headers and status of the given resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "376", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "377", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "378", + "type": { + "$id": "379", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "380", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned keys.", + "type": { + "$id": "381", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "382", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "383", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "384", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "385", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "386", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "387", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "388", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "389", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "390", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "391", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "392", + "kind": "constant", + "valueType": { + "$id": "393", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "394", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "395", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "396", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "HEAD", + "uri": "{endpoint}", + "path": "/keys", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkKeys", + "decorators": [], + "examples": [ + { + "$id": "397", + "kind": "http", + "name": "Check keys", + "description": "Check keys", + "filePath": "2024-09-01/CheckKeys.json", + "parameters": [ + { + "$id": "398", + "parameter": { + "$ref": "376" + }, + "value": { + "$id": "399", + "kind": "string", + "type": { + "$ref": "377" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "400", + "response": { + "$ref": "394" + }, + "statusCode": 200 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "401", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned keys.", + "type": { + "$id": "402", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "403", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "404", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "405", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "406", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "407", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "408", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "409", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "410", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "411", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "412", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "392" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "413" + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkKeys" + }, + { + "$id": "414", + "kind": "paging", + "name": "getKeyValues", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets a list of key-values.", + "summary": "Gets a list of key-values.", + "operation": { + "$id": "415", + "name": "getKeyValues", + "resourceName": "KeyValue", + "summary": "Gets a list of key-values.", + "doc": "Gets a list of key-values.", + "accessibility": "public", + "parameters": [ + { + "$id": "416", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "417", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "418", + "type": { + "$id": "419", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "420", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "421", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "422", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "423", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "424", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "425", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "426", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "427", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "428", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "429", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "430", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "431", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "432", + "name": "snapshot", + "nameInRequest": "snapshot", + "doc": "A filter used get key-values for a snapshot. The value should be the name of\nthe snapshot. Not valid when used with 'key' and 'label' filters.", + "type": { + "$id": "433", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "434", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "435", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "436", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "437", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "438", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "439", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "440", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": true, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "441", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "442", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "443", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "179" + }, + "headers": [ + { + "$id": "444", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "445", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "446", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "447", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "448", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "26" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.kvset+json", + "application/problem+json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/kv", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeyValues", + "decorators": [], + "examples": [ + { + "$id": "449", + "kind": "http", + "name": "Gets a list of key-values.", + "description": "Gets a list of key-values.", + "filePath": "2024-09-01/GetKeyValues.json", + "parameters": [ + { + "$id": "450", + "parameter": { + "$ref": "416" + }, + "value": { + "$id": "451", + "kind": "string", + "type": { + "$ref": "417" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "452", + "response": { + "$ref": "443" + }, + "statusCode": 200, + "bodyValue": { + "$id": "453", + "kind": "model", + "type": { + "$ref": "179" + }, + "value": { + "$id": "454", + "items": { + "$id": "455", + "kind": "array", + "type": { + "$ref": "181" + }, + "value": [ + { + "$id": "456", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "457", + "etag": { + "$id": "458", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "CTgHR5UrDKNj2nsoGWDOipST9Pv" + }, + "key": { + "$id": "459", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Background" + }, + "label": { + "$id": "460", + "kind": "string", + "type": { + "$ref": "188" + }, + "value": "Asset1" + }, + "value": { + "$id": "461", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "blue" + }, + "tags": { + "$id": "462", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "463" + } + }, + "locked": { + "$id": "464", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "465", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-03-04T17:12:23+00:00" + } + } + }, + { + "$id": "466", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "467", + "etag": { + "$id": "468", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "UTSN1zePHbBQ0npbRB6elGRRuH7" + }, + "key": { + "$id": "469", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "MaxLogFiles" + }, + "label": { + "$id": "470", + "kind": "string", + "type": { + "$ref": "188" + }, + "value": "Asset1" + }, + "value": { + "$id": "471", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "50" + }, + "tags": { + "$id": "472", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "473" + } + }, + "locked": { + "$id": "474", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "475", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-03-04T17:12:23+00:00" + } + } + }, + { + "$id": "476", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "477", + "etag": { + "$id": "478", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "7XpB48ET4VAlB9068ft6fKMyA3m" + }, + "key": { + "$id": "479", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "480", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World" + }, + "tags": { + "$id": "481", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "482" + } + }, + "locked": { + "$id": "483", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "484", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-06-20T16:52:23+00:00" + } + } + }, + { + "$id": "485", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "486", + "etag": { + "$id": "487", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "fAFm4jkGNB1hsIr4o0S5hnhCCvY" + }, + "key": { + "$id": "488", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "WebDemo:Settings:BackgroundColor" + }, + "value": { + "$id": "489", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "blue" + }, + "tags": { + "$id": "490", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "491" + } + }, + "locked": { + "$id": "492", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "493", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-06-20T15:48:01+00:00" + } + } + } + ] + } + } + } + } + ] + }, + { + "$id": "494", + "kind": "http", + "name": "Gets a list of key-values using the If-Match header.", + "description": "Gets a list of key-values using the If-Match header.", + "filePath": "2024-09-01/GetKeyValues_IfMatch.json", + "parameters": [ + { + "$id": "495", + "parameter": { + "$ref": "416" + }, + "value": { + "$id": "496", + "kind": "string", + "type": { + "$ref": "417" + }, + "value": "2024-09-01" + } + }, + { + "$id": "497", + "parameter": { + "$ref": "434" + }, + "value": { + "$id": "498", + "kind": "string", + "type": { + "$ref": "435" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "499", + "response": { + "$ref": "443" + }, + "statusCode": 200, + "bodyValue": { + "$id": "500", + "kind": "model", + "type": { + "$ref": "179" + }, + "value": { + "$id": "501", + "items": { + "$id": "502", + "kind": "array", + "type": { + "$ref": "181" + }, + "value": [ + { + "$id": "503", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "504", + "etag": { + "$id": "505", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "CTgHR5UrDKNj2nsoGWDOipST9Pv" + }, + "key": { + "$id": "506", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Background" + }, + "label": { + "$id": "507", + "kind": "string", + "type": { + "$ref": "188" + }, + "value": "Asset1" + }, + "value": { + "$id": "508", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "blue" + }, + "tags": { + "$id": "509", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "510" + } + }, + "locked": { + "$id": "511", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "512", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-03-04T17:12:23+00:00" + } + } + }, + { + "$id": "513", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "514", + "etag": { + "$id": "515", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "UTSN1zePHbBQ0npbRB6elGRRuH7" + }, + "key": { + "$id": "516", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "MaxLogFiles" + }, + "label": { + "$id": "517", + "kind": "string", + "type": { + "$ref": "188" + }, + "value": "Asset1" + }, + "value": { + "$id": "518", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "50" + }, + "tags": { + "$id": "519", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "520" + } + }, + "locked": { + "$id": "521", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "522", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-03-04T17:12:23+00:00" + } + } + }, + { + "$id": "523", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "524", + "etag": { + "$id": "525", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "7XpB48ET4VAlB9068ft6fKMyA3m" + }, + "key": { + "$id": "526", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "527", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World" + }, + "tags": { + "$id": "528", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "529" + } + }, + "locked": { + "$id": "530", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "531", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-06-20T16:52:23+00:00" + } + } + }, + { + "$id": "532", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "533", + "etag": { + "$id": "534", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "fAFm4jkGNB1hsIr4o0S5hnhCCvY" + }, + "key": { + "$id": "535", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "WebDemo:Settings:BackgroundColor" + }, + "value": { + "$id": "536", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "blue" + }, + "tags": { + "$id": "537", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "538" + } + }, + "locked": { + "$id": "539", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "540", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-06-20T15:48:01+00:00" + } + } + } + ] + } + } + } + } + ] + }, + { + "$id": "541", + "kind": "http", + "name": "Gets a list of key-values using the If-None-Match header.", + "description": "Gets a list of key-values using the If-None-Match header.", + "filePath": "2024-09-01/GetKeyValues_IfNoneMatch.json", + "parameters": [ + { + "$id": "542", + "parameter": { + "$ref": "416" + }, + "value": { + "$id": "543", + "kind": "string", + "type": { + "$ref": "417" + }, + "value": "2024-09-01" + } + }, + { + "$id": "544", + "parameter": { + "$ref": "436" + }, + "value": { + "$id": "545", + "kind": "string", + "type": { + "$ref": "437" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + } + } + ], + "responses": [ + { + "$id": "546", + "response": { + "$ref": "443" + }, + "statusCode": 200, + "bodyValue": { + "$id": "547", + "kind": "model", + "type": { + "$ref": "179" + }, + "value": { + "$id": "548", + "items": { + "$id": "549", + "kind": "array", + "type": { + "$ref": "181" + }, + "value": [ + { + "$id": "550", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "551", + "etag": { + "$id": "552", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "CTgHR5UrDKNj2nsoGWDOipST9Pv" + }, + "key": { + "$id": "553", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Background" + }, + "label": { + "$id": "554", + "kind": "string", + "type": { + "$ref": "188" + }, + "value": "Asset1" + }, + "value": { + "$id": "555", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "blue" + }, + "tags": { + "$id": "556", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "557" + } + }, + "locked": { + "$id": "558", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "559", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-03-04T17:12:23+00:00" + } + } + }, + { + "$id": "560", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "561", + "etag": { + "$id": "562", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "UTSN1zePHbBQ0npbRB6elGRRuH7" + }, + "key": { + "$id": "563", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "MaxLogFiles" + }, + "label": { + "$id": "564", + "kind": "string", + "type": { + "$ref": "188" + }, + "value": "Asset1" + }, + "value": { + "$id": "565", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "50" + }, + "tags": { + "$id": "566", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "567" + } + }, + "locked": { + "$id": "568", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "569", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-03-04T17:12:23+00:00" + } + } + }, + { + "$id": "570", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "571", + "etag": { + "$id": "572", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "7XpB48ET4VAlB9068ft6fKMyA3m" + }, + "key": { + "$id": "573", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "574", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World" + }, + "tags": { + "$id": "575", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "576" + } + }, + "locked": { + "$id": "577", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "578", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-06-20T16:52:23+00:00" + } + } + }, + { + "$id": "579", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "580", + "etag": { + "$id": "581", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "fAFm4jkGNB1hsIr4o0S5hnhCCvY" + }, + "key": { + "$id": "582", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "WebDemo:Settings:BackgroundColor" + }, + "value": { + "$id": "583", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "blue" + }, + "tags": { + "$id": "584", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "585" + } + }, + "locked": { + "$id": "586", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "587", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-06-20T15:48:01+00:00" + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "588", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "589", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "590", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "591", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "592", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "593", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "594", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "595", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "596", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "597", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "598", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "599", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "600", + "name": "snapshot", + "nameInRequest": "snapshot", + "doc": "A filter used get key-values for a snapshot. The value should be the name of\nthe snapshot. Not valid when used with 'key' and 'label' filters.", + "type": { + "$id": "601", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "602", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "603", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "604", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "605", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "606", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "607", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "608", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "609", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "442" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "610", + "type": { + "$id": "611", + "kind": "array", + "name": "ArrayKeyValue", + "valueType": { + "$ref": "182" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "resultSegments": [ + "items" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeyValues", + "pagingMetadata": { + "$id": "612", + "itemPropertySegments": [ + "items" + ], + "nextLink": { + "$id": "613", + "responseSegments": [ + "@nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "614", + "kind": "basic", + "name": "checkKeyValues", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Requests the headers and status of the given resource.", + "summary": "Requests the headers and status of the given resource.", + "operation": { + "$id": "615", + "name": "checkKeyValues", + "resourceName": "AzureAppConfiguration", + "summary": "Requests the headers and status of the given resource.", + "doc": "Requests the headers and status of the given resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "616", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "617", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "618", + "type": { + "$id": "619", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "620", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "621", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "622", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "623", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "624", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "625", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "626", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "627", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "628", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "629", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "630", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "631", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "632", + "name": "snapshot", + "nameInRequest": "snapshot", + "doc": "A filter used get key-values for a snapshot. The value should be the name of\nthe snapshot. Not valid when used with 'key' and 'label' filters.", + "type": { + "$id": "633", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "634", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "635", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "636", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "637", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "638", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "639", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "640", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": true, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "641", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "642", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "643", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "644", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "645", + "kind": "constant", + "valueType": { + "$id": "646", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "647", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "648", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "649", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "650", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "651", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "HEAD", + "uri": "{endpoint}", + "path": "/kv", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkKeyValues", + "decorators": [], + "examples": [ + { + "$id": "652", + "kind": "http", + "name": "Requests the headers and status of the given resource.", + "description": "Requests the headers and status of the given resource.", + "filePath": "2024-09-01/CheckKeyValues.json", + "parameters": [ + { + "$id": "653", + "parameter": { + "$ref": "616" + }, + "value": { + "$id": "654", + "kind": "string", + "type": { + "$ref": "617" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "655", + "response": { + "$ref": "647" + }, + "statusCode": 200 + } + ] + }, + { + "$id": "656", + "kind": "http", + "name": "Requests the headers and status of the given resource using the If-Match header.", + "description": "Requests the headers and status of the given resource using the If-Match header.", + "filePath": "2024-09-01/CheckKeyValues_IfMatch.json", + "parameters": [ + { + "$id": "657", + "parameter": { + "$ref": "616" + }, + "value": { + "$id": "658", + "kind": "string", + "type": { + "$ref": "617" + }, + "value": "2024-09-01" + } + }, + { + "$id": "659", + "parameter": { + "$ref": "634" + }, + "value": { + "$id": "660", + "kind": "string", + "type": { + "$ref": "635" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "661", + "response": { + "$ref": "647" + }, + "statusCode": 200 + } + ] + }, + { + "$id": "662", + "kind": "http", + "name": "Requests the headers and status of the given resource using the If-None-Match header.", + "description": "Requests the headers and status of the given resource using the If-None-Match header.", + "filePath": "2024-09-01/CheckKeyValues_IfNoneMatch.json", + "parameters": [ + { + "$id": "663", + "parameter": { + "$ref": "616" + }, + "value": { + "$id": "664", + "kind": "string", + "type": { + "$ref": "617" + }, + "value": "2024-09-01" + } + }, + { + "$id": "665", + "parameter": { + "$ref": "636" + }, + "value": { + "$id": "666", + "kind": "string", + "type": { + "$ref": "637" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "667", + "response": { + "$ref": "647" + }, + "statusCode": 200 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "668", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "669", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "670", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "671", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "672", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "673", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "674", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "675", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "676", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "677", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "678", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "679", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "680", + "name": "snapshot", + "nameInRequest": "snapshot", + "doc": "A filter used get key-values for a snapshot. The value should be the name of\nthe snapshot. Not valid when used with 'key' and 'label' filters.", + "type": { + "$id": "681", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "682", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "683", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "684", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "685", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "686", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "687", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "688", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "689", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "690", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "691", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "692", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "645" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "693" + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkKeyValues" + }, + { + "$id": "694", + "kind": "basic", + "name": "getKeyValue", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets a single key-value.", + "summary": "Gets a single key-value.", + "operation": { + "$id": "695", + "name": "getKeyValue", + "resourceName": "AzureAppConfiguration", + "summary": "Gets a single key-value.", + "doc": "Gets a single key-value.", + "accessibility": "public", + "parameters": [ + { + "$id": "696", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "697", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "698", + "type": { + "$id": "699", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "700", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value.", + "type": { + "$id": "701", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "702", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to retrieve.", + "type": { + "$id": "703", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "704", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "705", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "706", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "707", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "708", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "709", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "710", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "711", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "712", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "713", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "714", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "715", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "716", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "717", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "718", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "719", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": true, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "720", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "721", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "722", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "182" + }, + "headers": [ + { + "$id": "723", + "name": "requestId", + "nameInResponse": "x-ms-request-id", + "doc": "An opaque, globally-unique, server-generated string identifier for the request.", + "type": { + "$id": "724", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "725", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + }, + { + "$id": "726", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "727", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "728", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "729", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "730", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "32" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.kv+json", + "application/problem+json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/kv/{key}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeyValue", + "decorators": [], + "examples": [ + { + "$id": "731", + "kind": "http", + "name": "Gets a single key-value.", + "description": "Gets a single key-value.", + "filePath": "2024-09-01/GetKeyValue.json", + "parameters": [ + { + "$id": "732", + "parameter": { + "$ref": "696" + }, + "value": { + "$id": "733", + "kind": "string", + "type": { + "$ref": "697" + }, + "value": "2024-09-01" + } + }, + { + "$id": "734", + "parameter": { + "$ref": "700" + }, + "value": { + "$id": "735", + "kind": "string", + "type": { + "$ref": "701" + }, + "value": "Message" + } + } + ], + "responses": [ + { + "$id": "736", + "response": { + "$ref": "722" + }, + "statusCode": 200, + "bodyValue": { + "$id": "737", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "738", + "etag": { + "$id": "739", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "7XpB48ET4VAlB9068ft6fKMyA3m" + }, + "key": { + "$id": "740", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "741", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "742", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "743" + } + }, + "locked": { + "$id": "744", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "745", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + }, + { + "$id": "746", + "kind": "http", + "name": "Gets a single key-value using the If-Match header.", + "description": "Gets a single key-value using the If-Match header.", + "filePath": "2024-09-01/GetKeyValue_IfMatch.json", + "parameters": [ + { + "$id": "747", + "parameter": { + "$ref": "696" + }, + "value": { + "$id": "748", + "kind": "string", + "type": { + "$ref": "697" + }, + "value": "2024-09-01" + } + }, + { + "$id": "749", + "parameter": { + "$ref": "700" + }, + "value": { + "$id": "750", + "kind": "string", + "type": { + "$ref": "701" + }, + "value": "Message" + } + }, + { + "$id": "751", + "parameter": { + "$ref": "710" + }, + "value": { + "$id": "752", + "kind": "string", + "type": { + "$ref": "711" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "753", + "response": { + "$ref": "722" + }, + "statusCode": 200, + "bodyValue": { + "$id": "754", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "755", + "etag": { + "$id": "756", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + }, + "key": { + "$id": "757", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "758", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "759", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "760" + } + }, + "locked": { + "$id": "761", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "762", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + }, + { + "$id": "763", + "kind": "http", + "name": "Gets a single key-value using the If-None-Match header.", + "description": "Gets a single key-value using the If-None-Match header.", + "filePath": "2024-09-01/GetKeyValue_IfNoneMatch.json", + "parameters": [ + { + "$id": "764", + "parameter": { + "$ref": "696" + }, + "value": { + "$id": "765", + "kind": "string", + "type": { + "$ref": "697" + }, + "value": "2024-09-01" + } + }, + { + "$id": "766", + "parameter": { + "$ref": "700" + }, + "value": { + "$id": "767", + "kind": "string", + "type": { + "$ref": "701" + }, + "value": "Message" + } + }, + { + "$id": "768", + "parameter": { + "$ref": "712" + }, + "value": { + "$id": "769", + "kind": "string", + "type": { + "$ref": "713" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + } + } + ], + "responses": [ + { + "$id": "770", + "response": { + "$ref": "722" + }, + "statusCode": 200, + "bodyValue": { + "$id": "771", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "772", + "etag": { + "$id": "773", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "7XpB48ET4VAlB9068ft6fKMyA3m" + }, + "key": { + "$id": "774", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "775", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "776", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "777" + } + }, + "locked": { + "$id": "778", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "779", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "780", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value.", + "type": { + "$id": "781", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "782", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to retrieve.", + "type": { + "$id": "783", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "784", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "785", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "786", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "787", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "788", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "789", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "790", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "791", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "792", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "793", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "794", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "795", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "796", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "797", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "798", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "799", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "800", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "721" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "801", + "type": { + "$ref": "182" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getKeyValue" + }, + { + "$id": "802", + "kind": "basic", + "name": "putKeyValue", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Creates a key-value.", + "summary": "Creates a key-value.", + "operation": { + "$id": "803", + "name": "putKeyValue", + "resourceName": "AzureAppConfiguration", + "summary": "Creates a key-value.", + "doc": "Creates a key-value.", + "accessibility": "public", + "parameters": [ + { + "$id": "804", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "805", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "806", + "type": { + "$id": "807", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "808", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "38" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "809", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to create.", + "type": { + "$id": "810", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "811", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to create.", + "type": { + "$id": "812", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "813", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "814", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "815", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "816", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "817", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "818", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "819", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "820", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "821", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "822", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "823", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "824", + "name": "entity", + "nameInRequest": "entity", + "doc": "The key-value to create.", + "type": { + "$ref": "182" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "825", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "182" + }, + "headers": [ + { + "$id": "826", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "827", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "828", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "829", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "830", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "32" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.kv+json", + "application/problem+json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/kv/{key}", + "requestMediaTypes": [ + "application/vnd.microsoft.appconfig.kv+json", + "application/vnd.microsoft.appconfig.kvset+json", + "application/json", + "text/json", + "application/*+json", + "application/json-patch+json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.putKeyValue", + "decorators": [], + "examples": [ + { + "$id": "831", + "kind": "http", + "name": "Creates a key-value.", + "description": "Creates a key-value.", + "filePath": "2024-09-01/PutKeyValue.json", + "parameters": [ + { + "$id": "832", + "parameter": { + "$ref": "804" + }, + "value": { + "$id": "833", + "kind": "string", + "type": { + "$ref": "805" + }, + "value": "2024-09-01" + } + }, + { + "$id": "834", + "parameter": { + "$ref": "809" + }, + "value": { + "$id": "835", + "kind": "string", + "type": { + "$ref": "810" + }, + "value": "Message" + } + } + ], + "responses": [ + { + "$id": "836", + "response": { + "$ref": "825" + }, + "statusCode": 200, + "bodyValue": { + "$id": "837", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "838", + "etag": { + "$id": "839", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "tnIHBkDYQwtdNMLoWtr5aybkKwL" + }, + "key": { + "$id": "840", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "841", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "842", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "843" + } + }, + "locked": { + "$id": "844", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "845", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + }, + { + "$id": "846", + "kind": "http", + "name": "Creates a key-value with the If-Match header.", + "description": "Creates a key-value with the If-Match header.", + "filePath": "2024-09-01/PutKeyValue_IfMatch.json", + "parameters": [ + { + "$id": "847", + "parameter": { + "$ref": "804" + }, + "value": { + "$id": "848", + "kind": "string", + "type": { + "$ref": "805" + }, + "value": "2024-09-01" + } + }, + { + "$id": "849", + "parameter": { + "$ref": "809" + }, + "value": { + "$id": "850", + "kind": "string", + "type": { + "$ref": "810" + }, + "value": "Message" + } + }, + { + "$id": "851", + "parameter": { + "$ref": "815" + }, + "value": { + "$id": "852", + "kind": "string", + "type": { + "$ref": "816" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "853", + "response": { + "$ref": "825" + }, + "statusCode": 200, + "bodyValue": { + "$id": "854", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "855", + "etag": { + "$id": "856", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + }, + "key": { + "$id": "857", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "858", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "859", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "860" + } + }, + "locked": { + "$id": "861", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "862", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "863", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "38" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "864", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to create.", + "type": { + "$id": "865", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "866", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to create.", + "type": { + "$id": "867", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "868", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "869", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "870", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "871", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "872", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "873", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "874", + "name": "entity", + "nameInRequest": "entity", + "doc": "The key-value to create.", + "type": { + "$ref": "182" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "875", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "876", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "877", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "878", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "823" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "879", + "type": { + "$ref": "182" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.putKeyValue" + }, + { + "$id": "880", + "kind": "basic", + "name": "deleteKeyValue", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Deletes a key-value.", + "summary": "Deletes a key-value.", + "operation": { + "$id": "881", + "name": "deleteKeyValue", + "resourceName": "AzureAppConfiguration", + "summary": "Deletes a key-value.", + "doc": "Deletes a key-value.", + "accessibility": "public", + "parameters": [ + { + "$id": "882", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "883", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "884", + "type": { + "$id": "885", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "886", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to delete.", + "type": { + "$id": "887", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "888", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to delete.", + "type": { + "$id": "889", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "890", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "891", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "892", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "893", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "894", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "895", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "896", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "897", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "898", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "899", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "182" + }, + "headers": [ + { + "$id": "900", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "901", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "902", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "903", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "904", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "32" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.kv+json", + "application/problem+json" + ] + }, + { + "$id": "905", + "statusCodes": [ + 204 + ], + "headers": [ + { + "$id": "906", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "907", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/kv/{key}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.deleteKeyValue", + "decorators": [], + "examples": [ + { + "$id": "908", + "kind": "http", + "name": "Deletes a key-value.", + "description": "Deletes a key-value.", + "filePath": "2024-09-01/DeleteKeyValue.json", + "parameters": [ + { + "$id": "909", + "parameter": { + "$ref": "882" + }, + "value": { + "$id": "910", + "kind": "string", + "type": { + "$ref": "883" + }, + "value": "2024-09-01" + } + }, + { + "$id": "911", + "parameter": { + "$ref": "886" + }, + "value": { + "$id": "912", + "kind": "string", + "type": { + "$ref": "887" + }, + "value": "Message" + } + } + ], + "responses": [ + { + "$id": "913", + "response": { + "$ref": "899" + }, + "statusCode": 200, + "bodyValue": { + "$id": "914", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "915", + "etag": { + "$id": "916", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "7XpB48ET4VAlB9068ft6fKMyA3m" + }, + "key": { + "$id": "917", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "918", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "919", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "920" + } + }, + "locked": { + "$id": "921", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "922", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + }, + { + "$id": "923", + "response": { + "$ref": "905" + }, + "statusCode": 204 + } + ] + }, + { + "$id": "924", + "kind": "http", + "name": "Deletes a key-value using If-Match header", + "description": "Deletes a key-value using If-Match header", + "filePath": "2024-09-01/DeleteKeyValue_IfMatch.json", + "parameters": [ + { + "$id": "925", + "parameter": { + "$ref": "882" + }, + "value": { + "$id": "926", + "kind": "string", + "type": { + "$ref": "883" + }, + "value": "2024-09-01" + } + }, + { + "$id": "927", + "parameter": { + "$ref": "886" + }, + "value": { + "$id": "928", + "kind": "string", + "type": { + "$ref": "887" + }, + "value": "Message" + } + }, + { + "$id": "929", + "parameter": { + "$ref": "892" + }, + "value": { + "$id": "930", + "kind": "string", + "type": { + "$ref": "893" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "931", + "response": { + "$ref": "899" + }, + "statusCode": 200, + "bodyValue": { + "$id": "932", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "933", + "etag": { + "$id": "934", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + }, + "key": { + "$id": "935", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "936", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "937", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "938" + } + }, + "locked": { + "$id": "939", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "940", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + }, + { + "$id": "941", + "response": { + "$ref": "905" + }, + "statusCode": 204 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "942", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to delete.", + "type": { + "$id": "943", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "944", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to delete.", + "type": { + "$id": "945", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "946", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "947", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "948", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "949", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "950", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "951", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "952", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "953", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "898" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "954", + "type": { + "$id": "955", + "kind": "nullable", + "type": { + "$ref": "182" + }, + "namespace": "Azure.Data.AppConfiguration" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.deleteKeyValue" + }, + { + "$id": "956", + "kind": "basic", + "name": "checkKeyValue", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Requests the headers and status of the given resource.", + "summary": "Requests the headers and status of the given resource.", + "operation": { + "$id": "957", + "name": "checkKeyValue", + "resourceName": "AzureAppConfiguration", + "summary": "Requests the headers and status of the given resource.", + "doc": "Requests the headers and status of the given resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "958", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "959", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "960", + "type": { + "$id": "961", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "962", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to retrieve.", + "type": { + "$id": "963", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "964", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to retrieve.", + "type": { + "$id": "965", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "966", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "967", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "968", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "969", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "970", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "971", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "972", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "973", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "974", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "975", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "976", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "977", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "978", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": true, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "979", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "980", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "981", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "982", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "983", + "kind": "constant", + "valueType": { + "$id": "984", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "985", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "986", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "987", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "988", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "989", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "HEAD", + "uri": "{endpoint}", + "path": "/kv/{key}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkKeyValue", + "decorators": [], + "examples": [ + { + "$id": "990", + "kind": "http", + "name": "Requests the headers and status of the given resource.", + "description": "Requests the headers and status of the given resource.", + "filePath": "2024-09-01/CheckKeyValue.json", + "parameters": [ + { + "$id": "991", + "parameter": { + "$ref": "958" + }, + "value": { + "$id": "992", + "kind": "string", + "type": { + "$ref": "959" + }, + "value": "2024-09-01" + } + }, + { + "$id": "993", + "parameter": { + "$ref": "962" + }, + "value": { + "$id": "994", + "kind": "string", + "type": { + "$ref": "963" + }, + "value": "Message" + } + } + ], + "responses": [ + { + "$id": "995", + "response": { + "$ref": "985" + }, + "statusCode": 200 + } + ] + }, + { + "$id": "996", + "kind": "http", + "name": "Requests the headers and status of the given resource using the If-Match header.", + "description": "Requests the headers and status of the given resource using the If-Match header.", + "filePath": "2024-09-01/CheckKeyValue_IfMatch.json", + "parameters": [ + { + "$id": "997", + "parameter": { + "$ref": "958" + }, + "value": { + "$id": "998", + "kind": "string", + "type": { + "$ref": "959" + }, + "value": "2024-09-01" + } + }, + { + "$id": "999", + "parameter": { + "$ref": "962" + }, + "value": { + "$id": "1000", + "kind": "string", + "type": { + "$ref": "963" + }, + "value": "Message" + } + }, + { + "$id": "1001", + "parameter": { + "$ref": "970" + }, + "value": { + "$id": "1002", + "kind": "string", + "type": { + "$ref": "971" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "1003", + "response": { + "$ref": "985" + }, + "statusCode": 200 + } + ] + }, + { + "$id": "1004", + "kind": "http", + "name": "Requests the headers and status of the given resource using the If-None-Match header.", + "description": "Requests the headers and status of the given resource using the If-None-Match header.", + "filePath": "2024-09-01/CheckKeyValue_IfNoneMatch.json", + "parameters": [ + { + "$id": "1005", + "parameter": { + "$ref": "958" + }, + "value": { + "$id": "1006", + "kind": "string", + "type": { + "$ref": "959" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1007", + "parameter": { + "$ref": "962" + }, + "value": { + "$id": "1008", + "kind": "string", + "type": { + "$ref": "963" + }, + "value": "Message" + } + }, + { + "$id": "1009", + "parameter": { + "$ref": "972" + }, + "value": { + "$id": "1010", + "kind": "string", + "type": { + "$ref": "973" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + } + } + ], + "responses": [ + { + "$id": "1011", + "response": { + "$ref": "985" + }, + "statusCode": 200 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1012", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to retrieve.", + "type": { + "$id": "1013", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1014", + "name": "label", + "nameInRequest": "label", + "doc": "The label of the key-value to retrieve.", + "type": { + "$id": "1015", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1016", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1017", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1018", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1019", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1020", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1021", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1022", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1023", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1024", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1025", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1026", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/keyvaluefiltering", + "type": { + "$id": "1027", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "1028", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1029", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1030", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1031", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1032", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "983" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1033" + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkKeyValue" + }, + { + "$id": "1034", + "kind": "paging", + "name": "getSnapshots", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets a list of key-value snapshots.", + "summary": "Gets a list of key-value snapshots.", + "operation": { + "$id": "1035", + "name": "getSnapshots", + "resourceName": "Snapshot", + "summary": "Gets a list of key-value snapshots.", + "doc": "Gets a list of key-value snapshots.", + "accessibility": "public", + "parameters": [ + { + "$id": "1036", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1037", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1038", + "type": { + "$id": "1039", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1040", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned snapshots.", + "type": { + "$id": "1041", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1042", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1043", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1044", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1045", + "kind": "array", + "name": "ArraySnapshotFields", + "valueType": { + "$ref": "52" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1046", + "name": "status", + "nameInRequest": "status", + "doc": "Used to filter returned snapshots by their status property.", + "type": { + "$id": "1047", + "kind": "array", + "name": "ArraySnapshotStatus", + "valueType": { + "$ref": "76" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1048", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1049", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1050", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1051", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1052", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "228" + }, + "headers": [ + { + "$id": "1053", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1054", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1055", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "92" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.snapshotset+json", + "application/problem+json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/snapshots", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getSnapshots", + "decorators": [], + "examples": [ + { + "$id": "1056", + "kind": "http", + "name": "Gets a list of key-value snapshots.", + "description": "Gets a list of key-value snapshots.", + "filePath": "2024-09-01/GetSnapshots.json", + "parameters": [ + { + "$id": "1057", + "parameter": { + "$ref": "1036" + }, + "value": { + "$id": "1058", + "kind": "string", + "type": { + "$ref": "1037" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "1059", + "response": { + "$ref": "1052" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1060", + "kind": "model", + "type": { + "$ref": "228" + }, + "value": { + "$id": "1061", + "items": { + "$id": "1062", + "kind": "array", + "type": { + "$ref": "230" + }, + "value": [ + { + "$id": "1063", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1064", + "etag": { + "$id": "1065", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1066", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1067", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "ready" + }, + "filters": { + "$id": "1068", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1069", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1070", + "key": { + "$id": "1071", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1072", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1073", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1074", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "size": { + "$id": "1075", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 100000 + }, + "items_count": { + "$id": "1076", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 71 + }, + "retention_period": { + "$id": "1077", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 2592000 + }, + "tags": { + "$id": "1078", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1079", + "release": { + "$id": "1080", + "kind": "string", + "type": { + "$ref": "285" + }, + "value": "{link/id}" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1081", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned snapshots.", + "type": { + "$id": "1082", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1083", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1084", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1085", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1086", + "kind": "array", + "name": "ArraySnapshotFields", + "valueType": { + "$ref": "52" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1087", + "name": "status", + "nameInRequest": "status", + "doc": "Used to filter returned snapshots by their status property.", + "type": { + "$id": "1088", + "kind": "array", + "name": "ArraySnapshotStatus", + "valueType": { + "$ref": "76" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1089", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1090", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1091", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1051" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1092", + "type": { + "$id": "1093", + "kind": "array", + "name": "ArraySnapshot", + "valueType": { + "$ref": "231" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "resultSegments": [ + "items" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getSnapshots", + "pagingMetadata": { + "$id": "1094", + "itemPropertySegments": [ + "items" + ], + "nextLink": { + "$id": "1095", + "responseSegments": [ + "@nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "1096", + "kind": "basic", + "name": "checkSnapshots", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Requests the headers and status of the given resource.", + "summary": "Requests the headers and status of the given resource.", + "operation": { + "$id": "1097", + "name": "checkSnapshots", + "resourceName": "AzureAppConfiguration", + "summary": "Requests the headers and status of the given resource.", + "doc": "Requests the headers and status of the given resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1098", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1099", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1100", + "type": { + "$id": "1101", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1102", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1103", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1104", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1105", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1106", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1107", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1108", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1109", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1110", + "kind": "constant", + "valueType": { + "$id": "1111", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1112", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "1113", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1114", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "HEAD", + "uri": "{endpoint}", + "path": "/snapshots", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkSnapshots", + "decorators": [], + "examples": [ + { + "$id": "1115", + "kind": "http", + "name": "Requests the headers and status of the given resource.", + "description": "Requests the headers and status of the given resource.", + "filePath": "2024-09-01/CheckSnapshots.json", + "parameters": [ + { + "$id": "1116", + "parameter": { + "$ref": "1098" + }, + "value": { + "$id": "1117", + "kind": "string", + "type": { + "$ref": "1099" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "1118", + "response": { + "$ref": "1112" + }, + "statusCode": 200 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1119", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1120", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1121", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1122", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1123", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1124", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1125", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1126", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1110" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1127" + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkSnapshots" + }, + { + "$id": "1128", + "kind": "basic", + "name": "getSnapshot", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets a single key-value snapshot.", + "summary": "Gets a single key-value snapshot.", + "operation": { + "$id": "1129", + "name": "getSnapshot", + "resourceName": "Snapshot", + "summary": "Gets a single key-value snapshot.", + "doc": "Gets a single key-value snapshot.", + "accessibility": "public", + "parameters": [ + { + "$id": "1130", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1131", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1132", + "type": { + "$id": "1133", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1134", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the snapshot.", + "type": { + "$id": "1135", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1136", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1137", + "kind": "array", + "name": "ArraySnapshotFields", + "valueType": { + "$ref": "52" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1138", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1139", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1140", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1141", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1142", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1143", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1144", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1145", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1146", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1147", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1148", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1149", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "231" + }, + "headers": [ + { + "$id": "1150", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1151", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1152", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1153", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1154", + "name": "link", + "nameInResponse": "Link", + "doc": "Includes links to related resources.", + "type": { + "$id": "1155", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1156", + "name": "requestId", + "nameInResponse": "x-ms-request-id", + "doc": "An opaque, globally-unique, server-generated string identifier for the request.", + "type": { + "$id": "1157", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1158", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + }, + { + "$id": "1159", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "98" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.snapshot+json", + "application/problem+json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/snapshots/{name}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getSnapshot", + "decorators": [], + "examples": [ + { + "$id": "1160", + "kind": "http", + "name": "Gets a single key-value snapshot.", + "description": "Gets a single key-value snapshot.", + "filePath": "2024-09-01/GetSnapshot.json", + "parameters": [ + { + "$id": "1161", + "parameter": { + "$ref": "1130" + }, + "value": { + "$id": "1162", + "kind": "string", + "type": { + "$ref": "1131" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1163", + "parameter": { + "$ref": "1134" + }, + "value": { + "$id": "1164", + "kind": "string", + "type": { + "$ref": "1135" + }, + "value": "Prod-2022-08-01" + } + } + ], + "responses": [ + { + "$id": "1165", + "response": { + "$ref": "1149" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1166", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1167", + "etag": { + "$id": "1168", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1169", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1170", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "ready" + }, + "filters": { + "$id": "1171", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1172", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1173", + "key": { + "$id": "1174", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1175", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1176", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1177", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "size": { + "$id": "1178", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 100000 + }, + "items_count": { + "$id": "1179", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 71 + }, + "retention_period": { + "$id": "1180", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 2592000 + }, + "tags": { + "$id": "1181", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1182", + "release": { + "$id": "1183", + "kind": "string", + "type": { + "$ref": "285" + }, + "value": "{link/id}" + } + } + } + } + } + } + ] + }, + { + "$id": "1184", + "kind": "http", + "name": "Gets a single key-value snapshot failed.", + "description": "Gets a single key-value snapshot failed.", + "filePath": "2024-09-01/GetSnapshot_Failed.json", + "parameters": [ + { + "$id": "1185", + "parameter": { + "$ref": "1130" + }, + "value": { + "$id": "1186", + "kind": "string", + "type": { + "$ref": "1131" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1187", + "parameter": { + "$ref": "1134" + }, + "value": { + "$id": "1188", + "kind": "string", + "type": { + "$ref": "1135" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1189", + "parameter": { + "$ref": "1140" + }, + "value": { + "$id": "1190", + "kind": "string", + "type": { + "$ref": "1141" + }, + "value": "\"4f6dd610dd5e4deebc7fbaef685fb903\"" + } + } + ], + "responses": [ + { + "$id": "1191", + "response": { + "$ref": "1149" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1192", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1193", + "etag": { + "$id": "1194", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1195", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1196", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "failed" + }, + "filters": { + "$id": "1197", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1198", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1199", + "key": { + "$id": "1200", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1201", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1202", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1203", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "size": { + "$id": "1204", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 0 + }, + "items_count": { + "$id": "1205", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 0 + }, + "retention_period": { + "$id": "1206", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 2592000 + }, + "tags": { + "$id": "1207", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1208", + "release": { + "$id": "1209", + "kind": "string", + "type": { + "$ref": "285" + }, + "value": "{link/id}" + } + } + } + } + } + } + ] + }, + { + "$id": "1210", + "kind": "http", + "name": "Gets a single key-value snapshot using If-Match header.", + "description": "Gets a single key-value snapshot using If-Match header.", + "filePath": "2024-09-01/GetSnapshot_IfMatch.json", + "parameters": [ + { + "$id": "1211", + "parameter": { + "$ref": "1130" + }, + "value": { + "$id": "1212", + "kind": "string", + "type": { + "$ref": "1131" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1213", + "parameter": { + "$ref": "1134" + }, + "value": { + "$id": "1214", + "kind": "string", + "type": { + "$ref": "1135" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1215", + "parameter": { + "$ref": "1140" + }, + "value": { + "$id": "1216", + "kind": "string", + "type": { + "$ref": "1141" + }, + "value": "\"4f6dd610dd5e4deebc7fbaef685fb903\"" + } + } + ], + "responses": [ + { + "$id": "1217", + "response": { + "$ref": "1149" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1218", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1219", + "etag": { + "$id": "1220", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1221", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1222", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "ready" + }, + "filters": { + "$id": "1223", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1224", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1225", + "key": { + "$id": "1226", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1227", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1228", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1229", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "size": { + "$id": "1230", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 100000 + }, + "items_count": { + "$id": "1231", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 71 + }, + "retention_period": { + "$id": "1232", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 2592000 + }, + "tags": { + "$id": "1233", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1234", + "release": { + "$id": "1235", + "kind": "string", + "type": { + "$ref": "285" + }, + "value": "{link/id}" + } + } + } + } + } + } + ] + }, + { + "$id": "1236", + "kind": "http", + "name": "Gets a single key-value snapshot using If-None-Match header.", + "description": "Gets a single key-value snapshot using If-None-Match header.", + "filePath": "2024-09-01/GetSnapshot_IfNoneMatch.json", + "parameters": [ + { + "$id": "1237", + "parameter": { + "$ref": "1130" + }, + "value": { + "$id": "1238", + "kind": "string", + "type": { + "$ref": "1131" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1239", + "parameter": { + "$ref": "1134" + }, + "value": { + "$id": "1240", + "kind": "string", + "type": { + "$ref": "1135" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1241", + "parameter": { + "$ref": "1142" + }, + "value": { + "$id": "1242", + "kind": "string", + "type": { + "$ref": "1143" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "1243", + "response": { + "$ref": "1149" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1244", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1245", + "etag": { + "$id": "1246", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1247", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1248", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "ready" + }, + "filters": { + "$id": "1249", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1250", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1251", + "key": { + "$id": "1252", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1253", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1254", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1255", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "size": { + "$id": "1256", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 100000 + }, + "items_count": { + "$id": "1257", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 71 + }, + "retention_period": { + "$id": "1258", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 2592000 + }, + "tags": { + "$id": "1259", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1260", + "release": { + "$id": "1261", + "kind": "string", + "type": { + "$ref": "285" + }, + "value": "{link/id}" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1262", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the snapshot.", + "type": { + "$id": "1263", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1264", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1265", + "kind": "array", + "name": "ArraySnapshotFields", + "valueType": { + "$ref": "52" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1266", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1267", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1268", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1269", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1270", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1271", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1272", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1273", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1274", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1275", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1148" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1276", + "type": { + "$ref": "231" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getSnapshot" + }, + { + "$id": "1277", + "kind": "basic", + "name": "getOperationDetails", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets the state of a long running operation.", + "summary": "Gets the state of a long running operation.", + "operation": { + "$id": "1278", + "name": "getOperationDetails", + "resourceName": "AzureAppConfiguration", + "summary": "Gets the state of a long running operation.", + "doc": "Gets the state of a long running operation.", + "accessibility": "public", + "parameters": [ + { + "$id": "1279", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1280", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1281", + "type": { + "$id": "1282", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1283", + "name": "snapshot", + "nameInRequest": "snapshot", + "doc": "Snapshot identifier for the long running operation.", + "type": { + "$id": "1284", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1285", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1286", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1287", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1288", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1289", + "kind": "constant", + "valueType": { + "$id": "1290", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1291", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "298" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/operations", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getOperationDetails", + "decorators": [], + "examples": [ + { + "$id": "1292", + "kind": "http", + "name": "Gets the state of a long running operation.", + "description": "Gets the state of a long running operation.", + "filePath": "2024-09-01/GetOperationStatus.json", + "parameters": [ + { + "$id": "1293", + "parameter": { + "$ref": "1279" + }, + "value": { + "$id": "1294", + "kind": "string", + "type": { + "$ref": "1280" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1295", + "parameter": { + "$ref": "1283" + }, + "value": { + "$id": "1296", + "kind": "string", + "type": { + "$ref": "1284" + }, + "value": "Prod-2022-08-01" + } + } + ], + "responses": [ + { + "$id": "1297", + "response": { + "$ref": "1291" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1298", + "kind": "model", + "type": { + "$ref": "298" + }, + "value": { + "$id": "1299", + "id": { + "$id": "1300", + "kind": "string", + "type": { + "$ref": "300" + }, + "value": "4yghgV_8lJJ5t7_kxhMpsyNCyjmZE5Q6zU0pXOp7Jvs" + }, + "status": { + "$id": "1301", + "kind": "string", + "type": { + "$ref": "104" + }, + "value": "Running" + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1302", + "name": "snapshot", + "nameInRequest": "snapshot", + "doc": "Snapshot identifier for the long running operation.", + "type": { + "$id": "1303", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1304", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1305", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1306", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1307", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1289" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1308", + "type": { + "$ref": "298" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getOperationDetails" + }, + { + "$id": "1309", + "kind": "lro", + "name": "createSnapshot", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Creates a key-value snapshot.", + "summary": "Creates a key-value snapshot.", + "operation": { + "$id": "1310", + "name": "createSnapshot", + "resourceName": "Snapshot", + "summary": "Creates a key-value snapshot.", + "doc": "Creates a key-value snapshot.", + "accessibility": "public", + "parameters": [ + { + "$id": "1311", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1312", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1313", + "type": { + "$id": "1314", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1315", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "116" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1316", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the key-value snapshot to create.", + "type": { + "$id": "1317", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1318", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1319", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1320", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1321", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1322", + "name": "entity", + "nameInRequest": "entity", + "doc": "The key-value snapshot to create.", + "type": { + "$ref": "231" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1323", + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "231" + }, + "headers": [ + { + "$id": "1324", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1325", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1326", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1327", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1328", + "name": "link", + "nameInResponse": "Link", + "doc": "Includes links to related resources.", + "type": { + "$id": "1329", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1330", + "name": "operationLocation", + "nameInResponse": "Operation-Location", + "doc": "The location for monitoring the operation state.", + "type": { + "$id": "1331", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "1332", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + } + }, + { + "$id": "1333", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "98" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.snapshot+json", + "application/problem+json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/snapshots/{name}", + "requestMediaTypes": [ + "application/vnd.microsoft.appconfig.snapshot+json", + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.createSnapshot", + "decorators": [], + "examples": [ + { + "$id": "1334", + "kind": "http", + "name": "Creates a key-value snapshot.", + "description": "Creates a key-value snapshot.", + "filePath": "2024-09-01/CreateSnapshot.json", + "parameters": [ + { + "$id": "1335", + "parameter": { + "$ref": "1311" + }, + "value": { + "$id": "1336", + "kind": "string", + "type": { + "$ref": "1312" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1337", + "parameter": { + "$ref": "1316" + }, + "value": { + "$id": "1338", + "kind": "string", + "type": { + "$ref": "1317" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1339", + "parameter": { + "$ref": "1322" + }, + "value": { + "$id": "1340", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1341", + "filters": { + "$id": "1342", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1343", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1344", + "key": { + "$id": "1345", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1346", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "retention_period": { + "$id": "1347", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 3600 + } + } + } + } + ], + "responses": [ + { + "$id": "1348", + "response": { + "$ref": "1323" + }, + "statusCode": 201, + "bodyValue": { + "$id": "1349", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1350", + "etag": { + "$id": "1351", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1352", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1353", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "provisioning" + }, + "filters": { + "$id": "1354", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1355", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1356", + "key": { + "$id": "1357", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1358", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1359", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1360", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "size": { + "$id": "1361", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 0 + }, + "items_count": { + "$id": "1362", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 0 + }, + "retention_period": { + "$id": "1363", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 3600 + }, + "tags": { + "$id": "1364", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1365" + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1366", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "116" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1367", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the key-value snapshot to create.", + "type": { + "$id": "1368", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1369", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1370", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1371", + "name": "entity", + "nameInRequest": "entity", + "doc": "The key-value snapshot to create.", + "type": { + "$ref": "231" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1372", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$id": "1373", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1374", + "type": { + "$ref": "231" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.createSnapshot", + "lroMetadata": { + "$id": "1375", + "finalStateVia": 2, + "finalResponse": { + "$id": "1376", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "231" + } + } + } + }, + { + "$id": "1377", + "kind": "basic", + "name": "updateSnapshot", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Updates the state of a key-value snapshot.", + "summary": "Updates the state of a key-value snapshot.", + "operation": { + "$id": "1378", + "name": "updateSnapshot", + "resourceName": "AzureAppConfiguration", + "summary": "Updates the state of a key-value snapshot.", + "doc": "Updates the state of a key-value snapshot.", + "accessibility": "public", + "parameters": [ + { + "$id": "1379", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1380", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1381", + "type": { + "$id": "1382", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1383", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "122" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1384", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the key-value snapshot to update.", + "type": { + "$id": "1385", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1386", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1387", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1388", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1389", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1390", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1391", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1392", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1393", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1394", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1395", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1396", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1397", + "name": "entity", + "nameInRequest": "entity", + "doc": "The parameters used to update the snapshot.", + "type": { + "$ref": "309" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1398", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "231" + }, + "headers": [ + { + "$id": "1399", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1400", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1401", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1402", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1403", + "name": "link", + "nameInResponse": "Link", + "doc": "Includes links to related resources.", + "type": { + "$id": "1404", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1405", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "98" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.snapshot+json", + "application/problem+json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/snapshots/{name}", + "requestMediaTypes": [ + "application/merge-patch+json", + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "AzureAppConfiguration.updateSnapshot", + "decorators": [], + "examples": [ + { + "$id": "1406", + "kind": "http", + "name": "Updates the state of a key-value snapshot.", + "description": "Updates the state of a key-value snapshot.", + "filePath": "2024-09-01/UpdateSnapshot.json", + "parameters": [ + { + "$id": "1407", + "parameter": { + "$ref": "1379" + }, + "value": { + "$id": "1408", + "kind": "string", + "type": { + "$ref": "1380" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1409", + "parameter": { + "$ref": "1384" + }, + "value": { + "$id": "1410", + "kind": "string", + "type": { + "$ref": "1385" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1411", + "parameter": { + "$ref": "1397" + }, + "value": { + "$id": "1412", + "kind": "model", + "type": { + "$ref": "309" + }, + "value": { + "$id": "1413", + "status": { + "$id": "1414", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "archived" + } + } + } + } + ], + "responses": [ + { + "$id": "1415", + "response": { + "$ref": "1398" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1416", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1417", + "etag": { + "$id": "1418", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1419", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1420", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "archived" + }, + "filters": { + "$id": "1421", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1422", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1423", + "key": { + "$id": "1424", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1425", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1426", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1427", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "expires": { + "$id": "1428", + "kind": "string", + "type": { + "$ref": "266" + }, + "value": "2022-09-01T22:19:40+00:00" + }, + "size": { + "$id": "1429", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 10000 + }, + "items_count": { + "$id": "1430", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 70 + }, + "retention_period": { + "$id": "1431", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 2592000 + }, + "tags": { + "$id": "1432", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1433" + } + } + } + } + } + ] + }, + { + "$id": "1434", + "kind": "http", + "name": "Updates the state of a key-value snapshot using the If-Match header.", + "description": "Updates the state of a key-value snapshot using the If-Match header.", + "filePath": "2024-09-01/UpdateSnapshot_IfMatch.json", + "parameters": [ + { + "$id": "1435", + "parameter": { + "$ref": "1379" + }, + "value": { + "$id": "1436", + "kind": "string", + "type": { + "$ref": "1380" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1437", + "parameter": { + "$ref": "1384" + }, + "value": { + "$id": "1438", + "kind": "string", + "type": { + "$ref": "1385" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1439", + "parameter": { + "$ref": "1397" + }, + "value": { + "$id": "1440", + "kind": "model", + "type": { + "$ref": "309" + }, + "value": { + "$id": "1441", + "status": { + "$id": "1442", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "archived" + } + } + } + }, + { + "$id": "1443", + "parameter": { + "$ref": "1388" + }, + "value": { + "$id": "1444", + "kind": "string", + "type": { + "$ref": "1389" + }, + "value": "\"4f6dd610dd5e4deebc7fbaef685fb903\"" + } + } + ], + "responses": [ + { + "$id": "1445", + "response": { + "$ref": "1398" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1446", + "kind": "model", + "type": { + "$ref": "231" + }, + "value": { + "$id": "1447", + "etag": { + "$id": "1448", + "kind": "string", + "type": { + "$ref": "289" + }, + "value": "4f6dd610dd5e4deebc7fbaef685fb903" + }, + "name": { + "$id": "1449", + "kind": "string", + "type": { + "$ref": "233" + }, + "value": "Prod-2022-08-01" + }, + "status": { + "$id": "1450", + "kind": "string", + "type": { + "$ref": "76" + }, + "value": "archived" + }, + "filters": { + "$id": "1451", + "kind": "array", + "type": { + "$ref": "240" + }, + "value": [ + { + "$id": "1452", + "kind": "model", + "type": { + "$ref": "241" + }, + "value": { + "$id": "1453", + "key": { + "$id": "1454", + "kind": "string", + "type": { + "$ref": "243" + }, + "value": "app1/*" + }, + "label": { + "$id": "1455", + "kind": "string", + "type": { + "$ref": "247" + }, + "value": "Production" + } + } + } + ] + }, + "composition_type": { + "$id": "1456", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "all" + }, + "created": { + "$id": "1457", + "kind": "string", + "type": { + "$ref": "261" + }, + "value": "2022-08-01T22:19:40+00:00" + }, + "expires": { + "$id": "1458", + "kind": "string", + "type": { + "$ref": "266" + }, + "value": "2022-09-01T22:19:40+00:00" + }, + "size": { + "$id": "1459", + "kind": "number", + "type": { + "$ref": "275" + }, + "value": 10000 + }, + "items_count": { + "$id": "1460", + "kind": "number", + "type": { + "$ref": "279" + }, + "value": 70 + }, + "retention_period": { + "$id": "1461", + "kind": "number", + "type": { + "$ref": "271" + }, + "value": 2592000 + }, + "tags": { + "$id": "1462", + "kind": "dict", + "type": { + "$ref": "283" + }, + "value": { + "$id": "1463" + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1464", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "122" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1465", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the key-value snapshot to update.", + "type": { + "$id": "1466", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1467", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1468", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1469", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1470", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1471", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1472", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1473", + "name": "entity", + "nameInRequest": "entity", + "doc": "The parameters used to update the snapshot.", + "type": { + "$ref": "309" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1474", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1475", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1476", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1477", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1396" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1478", + "type": { + "$ref": "231" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.updateSnapshot" + }, + { + "$id": "1479", + "kind": "basic", + "name": "checkSnapshot", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Requests the headers and status of the given resource.", + "summary": "Requests the headers and status of the given resource.", + "operation": { + "$id": "1480", + "name": "checkSnapshot", + "resourceName": "AzureAppConfiguration", + "summary": "Requests the headers and status of the given resource.", + "doc": "Requests the headers and status of the given resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1481", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1482", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1483", + "type": { + "$id": "1484", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1485", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the key-value snapshot to check.", + "type": { + "$id": "1486", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1487", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1488", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1489", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1490", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1491", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1492", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1493", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1494", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1495", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1496", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1497", + "kind": "constant", + "valueType": { + "$id": "1498", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1499", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "1500", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1501", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1502", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1503", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1504", + "name": "link", + "nameInResponse": "Link", + "doc": "Includes links to related resources.", + "type": { + "$id": "1505", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "HEAD", + "uri": "{endpoint}", + "path": "/snapshots/{name}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkSnapshot", + "decorators": [], + "examples": [ + { + "$id": "1506", + "kind": "http", + "name": "Requests the headers and status of the given resource.", + "description": "Requests the headers and status of the given resource.", + "filePath": "2024-09-01/CheckSnapshot.json", + "parameters": [ + { + "$id": "1507", + "parameter": { + "$ref": "1481" + }, + "value": { + "$id": "1508", + "kind": "string", + "type": { + "$ref": "1482" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1509", + "parameter": { + "$ref": "1485" + }, + "value": { + "$id": "1510", + "kind": "string", + "type": { + "$ref": "1486" + }, + "value": "Prod-2022-08-01" + } + } + ], + "responses": [ + { + "$id": "1511", + "response": { + "$ref": "1499" + }, + "statusCode": 200 + } + ] + }, + { + "$id": "1512", + "kind": "http", + "name": "Requests the headers and status of the given resource using If-Match header.", + "description": "Requests the headers and status of the given resource using If-Match header.", + "filePath": "2024-09-01/CheckSnapshot_IfMatch.json", + "parameters": [ + { + "$id": "1513", + "parameter": { + "$ref": "1481" + }, + "value": { + "$id": "1514", + "kind": "string", + "type": { + "$ref": "1482" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1515", + "parameter": { + "$ref": "1485" + }, + "value": { + "$id": "1516", + "kind": "string", + "type": { + "$ref": "1486" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1517", + "parameter": { + "$ref": "1489" + }, + "value": { + "$id": "1518", + "kind": "string", + "type": { + "$ref": "1490" + }, + "value": "\"4f6dd610dd5e4deebc7fbaef685fb903\"" + } + } + ], + "responses": [ + { + "$id": "1519", + "response": { + "$ref": "1499" + }, + "statusCode": 200 + } + ] + }, + { + "$id": "1520", + "kind": "http", + "name": "Requests the headers and status of the given resource using If-None-Match header", + "description": "Requests the headers and status of the given resource using If-None-Match header", + "filePath": "2024-09-01/CheckSnapshot_IfNoneMatch.json", + "parameters": [ + { + "$id": "1521", + "parameter": { + "$ref": "1481" + }, + "value": { + "$id": "1522", + "kind": "string", + "type": { + "$ref": "1482" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1523", + "parameter": { + "$ref": "1485" + }, + "value": { + "$id": "1524", + "kind": "string", + "type": { + "$ref": "1486" + }, + "value": "Prod-2022-08-01" + } + }, + { + "$id": "1525", + "parameter": { + "$ref": "1491" + }, + "value": { + "$id": "1526", + "kind": "string", + "type": { + "$ref": "1492" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "1527", + "response": { + "$ref": "1499" + }, + "statusCode": 200 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1528", + "name": "name", + "nameInRequest": "name", + "doc": "The name of the key-value snapshot to check.", + "type": { + "$id": "1529", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1530", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1531", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1532", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1533", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1534", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1535", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1536", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1537", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1538", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1539", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1497" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1540" + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkSnapshot" + }, + { + "$id": "1541", + "kind": "paging", + "name": "getLabels", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets a list of labels.", + "summary": "Gets a list of labels.", + "operation": { + "$id": "1542", + "name": "getLabels", + "resourceName": "AzureAppConfiguration", + "summary": "Gets a list of labels.", + "doc": "Gets a list of labels.", + "accessibility": "public", + "parameters": [ + { + "$id": "1543", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1544", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1545", + "type": { + "$id": "1546", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1547", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned labels.", + "type": { + "$id": "1548", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1549", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1550", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1551", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1552", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1553", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1554", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1555", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1556", + "kind": "array", + "name": "ArrayLabelFields", + "valueType": { + "$ref": "128" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1557", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1558", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1559", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1560", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1561", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1562", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "313" + }, + "headers": [ + { + "$id": "1563", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1564", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1565", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "132" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.labelset+json", + "application/problem+json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/labels", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getLabels", + "decorators": [], + "examples": [ + { + "$id": "1566", + "kind": "http", + "name": "Gets a list of labels.", + "description": "Gets a list of labels.", + "filePath": "2024-09-01/GetLabels.json", + "parameters": [ + { + "$id": "1567", + "parameter": { + "$ref": "1543" + }, + "value": { + "$id": "1568", + "kind": "string", + "type": { + "$ref": "1544" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "1569", + "response": { + "$ref": "1562" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1570", + "kind": "model", + "type": { + "$ref": "313" + }, + "value": { + "$id": "1571", + "items": { + "$id": "1572", + "kind": "array", + "type": { + "$ref": "315" + }, + "value": [ + { + "$id": "1573", + "kind": "model", + "type": { + "$ref": "316" + }, + "value": { + "$id": "1574" + } + }, + { + "$id": "1575", + "kind": "model", + "type": { + "$ref": "316" + }, + "value": { + "$id": "1576", + "name": { + "$id": "1577", + "kind": "string", + "type": { + "$ref": "318" + }, + "value": "Asset1" + } + } + }, + { + "$id": "1578", + "kind": "model", + "type": { + "$ref": "316" + }, + "value": { + "$id": "1579", + "name": { + "$id": "1580", + "kind": "string", + "type": { + "$ref": "318" + }, + "value": "Asset1/devCi" + } + } + }, + { + "$id": "1581", + "kind": "model", + "type": { + "$ref": "316" + }, + "value": { + "$id": "1582", + "name": { + "$id": "1583", + "kind": "string", + "type": { + "$ref": "318" + }, + "value": "Asset1/devCi/branch1" + } + } + }, + { + "$id": "1584", + "kind": "model", + "type": { + "$ref": "316" + }, + "value": { + "$id": "1585", + "name": { + "$id": "1586", + "kind": "string", + "type": { + "$ref": "318" + }, + "value": "WestUs" + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1587", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned labels.", + "type": { + "$id": "1588", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1589", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1590", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1591", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1592", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1593", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1594", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1595", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1596", + "kind": "array", + "name": "ArrayLabelFields", + "valueType": { + "$ref": "128" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1597", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1598", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1599", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1600", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1561" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1601", + "type": { + "$id": "1602", + "kind": "array", + "name": "ArrayLabel", + "valueType": { + "$ref": "316" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "resultSegments": [ + "items" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getLabels", + "pagingMetadata": { + "$id": "1603", + "itemPropertySegments": [ + "items" + ], + "nextLink": { + "$id": "1604", + "responseSegments": [ + "@nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "1605", + "kind": "basic", + "name": "checkLabels", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Requests the headers and status of the given resource.", + "summary": "Requests the headers and status of the given resource.", + "operation": { + "$id": "1606", + "name": "checkLabels", + "resourceName": "AzureAppConfiguration", + "summary": "Requests the headers and status of the given resource.", + "doc": "Requests the headers and status of the given resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1607", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1608", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1609", + "type": { + "$id": "1610", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1611", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned labels.", + "type": { + "$id": "1612", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1613", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1614", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1615", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1616", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1617", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1618", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1619", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1620", + "kind": "array", + "name": "ArrayLabelFields", + "valueType": { + "$ref": "128" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1621", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1622", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1623", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1624", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1625", + "kind": "constant", + "valueType": { + "$id": "1626", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1627", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "1628", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1629", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "HEAD", + "uri": "{endpoint}", + "path": "/labels", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkLabels", + "decorators": [], + "examples": [ + { + "$id": "1630", + "kind": "http", + "name": "Requests the headers and status of the given resource.", + "description": "Requests the headers and status of the given resource.", + "filePath": "2024-09-01/CheckLabels.json", + "parameters": [ + { + "$id": "1631", + "parameter": { + "$ref": "1607" + }, + "value": { + "$id": "1632", + "kind": "string", + "type": { + "$ref": "1608" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "1633", + "response": { + "$ref": "1627" + }, + "statusCode": 200 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1634", + "name": "name", + "nameInRequest": "name", + "doc": "A filter for the name of the returned labels.", + "type": { + "$id": "1635", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1636", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1637", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1638", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1639", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1640", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1641", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1642", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1643", + "kind": "array", + "name": "ArrayLabelFields", + "valueType": { + "$ref": "128" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1644", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1645", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1646", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1647", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1625" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1648" + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkLabels" + }, + { + "$id": "1649", + "kind": "basic", + "name": "putLock", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Locks a key-value.", + "summary": "Locks a key-value.", + "operation": { + "$id": "1650", + "name": "putLock", + "resourceName": "AzureAppConfiguration", + "summary": "Locks a key-value.", + "doc": "Locks a key-value.", + "accessibility": "public", + "parameters": [ + { + "$id": "1651", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1652", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1653", + "type": { + "$id": "1654", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1655", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to lock.", + "type": { + "$id": "1656", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1657", + "name": "label", + "nameInRequest": "label", + "doc": "The label, if any, of the key-value to lock.", + "type": { + "$id": "1658", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1659", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1660", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1661", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1662", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1663", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1664", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1665", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1666", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1667", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1668", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1669", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1670", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "182" + }, + "headers": [ + { + "$id": "1671", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1672", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1673", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1674", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1675", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "32" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.kv+json", + "application/problem+json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/locks/{key}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.putLock", + "decorators": [], + "examples": [ + { + "$id": "1676", + "kind": "http", + "name": "Locks a key-value.", + "description": "Locks a key-value.", + "filePath": "2024-09-01/PutLock.json", + "parameters": [ + { + "$id": "1677", + "parameter": { + "$ref": "1651" + }, + "value": { + "$id": "1678", + "kind": "string", + "type": { + "$ref": "1652" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1679", + "parameter": { + "$ref": "1655" + }, + "value": { + "$id": "1680", + "kind": "string", + "type": { + "$ref": "1656" + }, + "value": "Message" + } + } + ], + "responses": [ + { + "$id": "1681", + "response": { + "$ref": "1670" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1682", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "1683", + "etag": { + "$id": "1684", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV4" + }, + "key": { + "$id": "1685", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "1686", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "1687", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "1688" + } + }, + "locked": { + "$id": "1689", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": true + }, + "last_modified": { + "$id": "1690", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + }, + { + "$id": "1691", + "kind": "http", + "name": "Locks a key-value using If-Match header.", + "description": "Locks a key-value using If-Match header.", + "filePath": "2024-09-01/PutLock_IfMatch.json", + "parameters": [ + { + "$id": "1692", + "parameter": { + "$ref": "1651" + }, + "value": { + "$id": "1693", + "kind": "string", + "type": { + "$ref": "1652" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1694", + "parameter": { + "$ref": "1655" + }, + "value": { + "$id": "1695", + "kind": "string", + "type": { + "$ref": "1656" + }, + "value": "Message" + } + }, + { + "$id": "1696", + "parameter": { + "$ref": "1661" + }, + "value": { + "$id": "1697", + "kind": "string", + "type": { + "$ref": "1662" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "1698", + "response": { + "$ref": "1670" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1699", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "1700", + "etag": { + "$id": "1701", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + }, + "key": { + "$id": "1702", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "1703", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "1704", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "1705" + } + }, + "locked": { + "$id": "1706", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": true + }, + "last_modified": { + "$id": "1707", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1708", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to lock.", + "type": { + "$id": "1709", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1710", + "name": "label", + "nameInRequest": "label", + "doc": "The label, if any, of the key-value to lock.", + "type": { + "$id": "1711", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1712", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1713", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1714", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1715", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1716", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1717", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1718", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1719", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1720", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1721", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1669" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1722", + "type": { + "$ref": "182" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.putLock" + }, + { + "$id": "1723", + "kind": "basic", + "name": "deleteLock", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Unlocks a key-value.", + "summary": "Unlocks a key-value.", + "operation": { + "$id": "1724", + "name": "deleteLock", + "resourceName": "AzureAppConfiguration", + "summary": "Unlocks a key-value.", + "doc": "Unlocks a key-value.", + "accessibility": "public", + "parameters": [ + { + "$id": "1725", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1726", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1727", + "type": { + "$id": "1728", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1729", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to unlock.", + "type": { + "$id": "1730", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1731", + "name": "label", + "nameInRequest": "label", + "doc": "The label, if any, of the key-value to unlock.", + "type": { + "$id": "1732", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1733", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1734", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1735", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1736", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1737", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1738", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1739", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1740", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1741", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1742", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1743", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1744", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "182" + }, + "headers": [ + { + "$id": "1745", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1746", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1747", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1748", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1749", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "32" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.kv+json", + "application/problem+json" + ] + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/locks/{key}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.deleteLock", + "decorators": [], + "examples": [ + { + "$id": "1750", + "kind": "http", + "name": "Unlocks a key-value.", + "description": "Unlocks a key-value.", + "filePath": "2024-09-01/DeleteLock.json", + "parameters": [ + { + "$id": "1751", + "parameter": { + "$ref": "1725" + }, + "value": { + "$id": "1752", + "kind": "string", + "type": { + "$ref": "1726" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1753", + "parameter": { + "$ref": "1729" + }, + "value": { + "$id": "1754", + "kind": "string", + "type": { + "$ref": "1730" + }, + "value": "Message" + } + } + ], + "responses": [ + { + "$id": "1755", + "response": { + "$ref": "1744" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1756", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "1757", + "etag": { + "$id": "1758", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "0BGYCoQ6iNdp5NtQ7N8shrobo6s" + }, + "key": { + "$id": "1759", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "1760", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "1761", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "1762" + } + }, + "locked": { + "$id": "1763", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "1764", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + }, + { + "$id": "1765", + "kind": "http", + "name": "Unlocks a key-value using If-Match header.", + "description": "Unlocks a key-value using If-Match header.", + "filePath": "2024-09-01/DeleteLock_IfMatch.json", + "parameters": [ + { + "$id": "1766", + "parameter": { + "$ref": "1725" + }, + "value": { + "$id": "1767", + "kind": "string", + "type": { + "$ref": "1726" + }, + "value": "2024-09-01" + } + }, + { + "$id": "1768", + "parameter": { + "$ref": "1729" + }, + "value": { + "$id": "1769", + "kind": "string", + "type": { + "$ref": "1730" + }, + "value": "Message" + } + }, + { + "$id": "1770", + "parameter": { + "$ref": "1735" + }, + "value": { + "$id": "1771", + "kind": "string", + "type": { + "$ref": "1736" + }, + "value": "\"L10qpBghN693OaxydgTkLmrBbV5\"" + } + } + ], + "responses": [ + { + "$id": "1772", + "response": { + "$ref": "1744" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1773", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "1774", + "etag": { + "$id": "1775", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV5" + }, + "key": { + "$id": "1776", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "1777", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "1778", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "1779" + } + }, + "locked": { + "$id": "1780", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "1781", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1782", + "name": "key", + "nameInRequest": "key", + "doc": "The key of the key-value to unlock.", + "type": { + "$id": "1783", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1784", + "name": "label", + "nameInRequest": "label", + "doc": "The label, if any, of the key-value to unlock.", + "type": { + "$id": "1785", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1786", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1787", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1788", + "name": "ifMatch", + "nameInRequest": "If-Match", + "doc": "Used to perform an operation only if the targeted resource's etag matches the\nvalue provided.", + "type": { + "$id": "1789", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1790", + "name": "ifNoneMatch", + "nameInRequest": "If-None-Match", + "doc": "Used to perform an operation only if the targeted resource's etag does not\nmatch the value provided.", + "type": { + "$id": "1791", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1792", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1793", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1794", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1795", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1743" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1796", + "type": { + "$ref": "182" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.deleteLock" + }, + { + "$id": "1797", + "kind": "paging", + "name": "getRevisions", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Gets a list of key-value revisions.", + "summary": "Gets a list of key-value revisions.", + "operation": { + "$id": "1798", + "name": "getRevisions", + "resourceName": "AzureAppConfiguration", + "summary": "Gets a list of key-value revisions.", + "doc": "Gets a list of key-value revisions.", + "accessibility": "public", + "parameters": [ + { + "$id": "1799", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1800", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1801", + "type": { + "$id": "1802", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1803", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1804", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1805", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1806", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1807", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1808", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1809", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1810", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1811", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1812", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1813", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1814", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1815", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1816", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "1817", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": true, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1818", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1819", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1820", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1821", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1822", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1823", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "179" + }, + "headers": [ + { + "$id": "1824", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1825", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1826", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1827", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1828", + "name": "contentType", + "nameInResponse": "Content-Type", + "doc": "Content-Type header", + "type": { + "$ref": "26" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/vnd.microsoft.appconfig.kvset+json", + "application/problem+json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/revisions", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getRevisions", + "decorators": [], + "examples": [ + { + "$id": "1829", + "kind": "http", + "name": "Gets a list of key-value revisions.", + "description": "Gets a list of key-value revisions.", + "filePath": "2024-09-01/GetRevisions.json", + "parameters": [ + { + "$id": "1830", + "parameter": { + "$ref": "1799" + }, + "value": { + "$id": "1831", + "kind": "string", + "type": { + "$ref": "1800" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "1832", + "response": { + "$ref": "1823" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1833", + "kind": "model", + "type": { + "$ref": "179" + }, + "value": { + "$id": "1834", + "items": { + "$id": "1835", + "kind": "array", + "type": { + "$ref": "181" + }, + "value": [ + { + "$id": "1836", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "1837", + "etag": { + "$id": "1838", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "0BGYCoQ6iNdp5NtQ7N8shrobo6s" + }, + "key": { + "$id": "1839", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "1840", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "1841", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "1842" + } + }, + "locked": { + "$id": "1843", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "1844", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:32+00:00" + } + } + }, + { + "$id": "1845", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "1846", + "etag": { + "$id": "1847", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "L10qpBghN693OaxydgTkLmrBbV4" + }, + "key": { + "$id": "1848", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "1849", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "A new message." + }, + "tags": { + "$id": "1850", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "1851" + } + }, + "locked": { + "$id": "1852", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "1853", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:52:20+00:00" + } + } + }, + { + "$id": "1854", + "kind": "model", + "type": { + "$ref": "182" + }, + "value": { + "$id": "1855", + "etag": { + "$id": "1856", + "kind": "string", + "type": { + "$ref": "215" + }, + "value": "tnIHBkDYQwtdNMLoWtr5aybkKwL" + }, + "key": { + "$id": "1857", + "kind": "string", + "type": { + "$ref": "184" + }, + "value": "Message" + }, + "value": { + "$id": "1858", + "kind": "string", + "type": { + "$ref": "196" + }, + "value": "Hello World!" + }, + "tags": { + "$id": "1859", + "kind": "dict", + "type": { + "$ref": "205" + }, + "value": { + "$id": "1860" + } + }, + "locked": { + "$id": "1861", + "kind": "boolean", + "type": { + "$ref": "211" + }, + "value": false + }, + "last_modified": { + "$id": "1862", + "kind": "string", + "type": { + "$ref": "200" + }, + "value": "2019-08-27T16:50:47+00:00" + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1863", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1864", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1865", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1866", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1867", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1868", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1869", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1870", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1871", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1872", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1873", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1874", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1875", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1876", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "1877", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1878", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1879", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1880", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1881", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1822" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1882", + "type": { + "$id": "1883", + "kind": "array", + "name": "ArrayKeyValue", + "valueType": { + "$ref": "182" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "resultSegments": [ + "items" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.getRevisions", + "pagingMetadata": { + "$id": "1884", + "itemPropertySegments": [ + "items" + ], + "nextLink": { + "$id": "1885", + "responseSegments": [ + "@nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "1886", + "kind": "basic", + "name": "checkRevisions", + "accessibility": "public", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ], + "doc": "Requests the headers and status of the given resource.", + "summary": "Requests the headers and status of the given resource.", + "operation": { + "$id": "1887", + "name": "checkRevisions", + "resourceName": "AzureAppConfiguration", + "summary": "Requests the headers and status of the given resource.", + "doc": "Requests the headers and status of the given resource.", + "accessibility": "public", + "parameters": [ + { + "$id": "1888", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1889", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1890", + "type": { + "$id": "1891", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2024-09-01" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1892", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1893", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1894", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1895", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1896", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1897", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1898", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1899", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1900", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1901", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1902", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1903", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1904", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1905", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "1906", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": true, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1907", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1908", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1909", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1910", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1911", + "kind": "constant", + "valueType": { + "$id": "1912", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1913", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "1914", + "name": "syncToken", + "nameInResponse": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1915", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "$id": "1916", + "name": "etagHeader", + "nameInResponse": "ETag", + "doc": "A value representing the current state of the resource.", + "type": { + "$id": "1917", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "HEAD", + "uri": "{endpoint}", + "path": "/revisions", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkRevisions", + "decorators": [], + "examples": [ + { + "$id": "1918", + "kind": "http", + "name": "Requests the headers and status of the given resource.", + "description": "Requests the headers and status of the given resource.", + "filePath": "2024-09-01/CheckRevisions.json", + "parameters": [ + { + "$id": "1919", + "parameter": { + "$ref": "1888" + }, + "value": { + "$id": "1920", + "kind": "string", + "type": { + "$ref": "1889" + }, + "value": "2024-09-01" + } + } + ], + "responses": [ + { + "$id": "1921", + "response": { + "$ref": "1913" + }, + "statusCode": 200 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1922", + "name": "key", + "nameInRequest": "key", + "doc": "A filter used to match keys. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1923", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1924", + "name": "label", + "nameInRequest": "label", + "doc": "A filter used to match labels. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1925", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1926", + "name": "syncToken", + "nameInRequest": "Sync-Token", + "doc": "Used to guarantee real-time consistency between requests.", + "type": { + "$id": "1927", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1928", + "name": "after", + "nameInRequest": "After", + "doc": "Instructs the server to return elements that appear after the element referred\nto by the specified token.", + "type": { + "$id": "1929", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1930", + "name": "acceptDatetime", + "nameInRequest": "Accept-Datetime", + "doc": "Requests the server to respond with the state of the resource at the specified\ntime.", + "type": { + "$id": "1931", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1932", + "name": "select", + "nameInRequest": "$Select", + "doc": "Used to select what fields are present in the returned resource(s).", + "type": { + "$id": "1933", + "kind": "array", + "name": "ArrayKeyValueFields", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1934", + "name": "tags", + "nameInRequest": "tags", + "doc": "A filter used to query by tags. Syntax reference:\nhttps://aka.ms/azconfig/docs/restapirevisions", + "type": { + "$id": "1935", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "1936", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1937", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1938", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1939", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1940", + "name": "accept", + "nameInRequest": "accept", + "type": { + "$ref": "1911" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "$id": "1941" + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "AzureAppConfiguration.checkRevisions" + } + ], + "parameters": [ + { + "$id": "1942", + "name": "endpoint", + "nameInRequest": "endpoint", + "type": { + "$id": "1943", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client" + } + ], + "decorators": [ + { + "$id": "1944", + "name": "TypeSpec.@service", + "arguments": { + "$id": "1945", + "options": { + "$id": "1946", + "title": "Azure App Configuration" + } + } + } + ], + "crossLanguageDefinitionId": "AzureAppConfiguration", + "apiVersions": [ + "2023-11-01", + "2024-09-01" + ] + } + ], + "auth": { + "$id": "1947", + "apiKey": { + "$id": "1948", + "name": "Connection String", + "in": "header" + }, + "oAuth2": { + "$id": "1949", + "scopes": [ + "https://azconfig.io/.default" + ] + } + } +} diff --git a/sdk/batch/Azure.Compute.Batch/tsp-location.yaml b/sdk/batch/Azure.Compute.Batch/tsp-location.yaml index 8e6c9fccab46..cd914323a85c 100644 --- a/sdk/batch/Azure.Compute.Batch/tsp-location.yaml +++ b/sdk/batch/Azure.Compute.Batch/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/batch/Azure.Batch -commit: e7ed63002df7e9cc1d3e4cd139d76c4d7040acd3 +commit: f79d4ed573ec12a63917b01e54baeaa52a914f3f repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.net8.0.cs b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.net8.0.cs index 95e5f86363f7..d258d1db567a 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.net8.0.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.net8.0.cs @@ -159,7 +159,7 @@ public DevBox(string name, string poolName) { } public Azure.Developer.DevCenter.Models.DevBoxHardwareProfile HardwareProfile { get { throw null; } } public Azure.Developer.DevCenter.Models.HibernateSupport? HibernateSupport { get { throw null; } } public Azure.Developer.DevCenter.Models.DevBoxImageReference ImageReference { get { throw null; } } - public Azure.Developer.DevCenter.Models.LocalAdministratorStatus? LocalAdministratorStatus { get { throw null; } set { } } + public Azure.Developer.DevCenter.Models.LocalAdministratorStatus? LocalAdministratorStatus { get { throw null; } } public Azure.Core.AzureLocation? Location { get { throw null; } } public string Name { get { throw null; } } public Azure.Developer.DevCenter.Models.DevBoxOSType? OSType { get { throw null; } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs index 95e5f86363f7..d258d1db567a 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs @@ -159,7 +159,7 @@ public DevBox(string name, string poolName) { } public Azure.Developer.DevCenter.Models.DevBoxHardwareProfile HardwareProfile { get { throw null; } } public Azure.Developer.DevCenter.Models.HibernateSupport? HibernateSupport { get { throw null; } } public Azure.Developer.DevCenter.Models.DevBoxImageReference ImageReference { get { throw null; } } - public Azure.Developer.DevCenter.Models.LocalAdministratorStatus? LocalAdministratorStatus { get { throw null; } set { } } + public Azure.Developer.DevCenter.Models.LocalAdministratorStatus? LocalAdministratorStatus { get { throw null; } } public Azure.Core.AzureLocation? Location { get { throw null; } } public string Name { get { throw null; } } public Azure.Developer.DevCenter.Models.DevBoxOSType? OSType { get { throw null; } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs index cc35748b809f..c22ac63469a0 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs @@ -101,7 +101,7 @@ public virtual Response GetEnvironment(string projectName, } /// - /// [Protocol Method] Gets an environment + /// [Protocol Method] Gets an environment. /// /// /// @@ -145,7 +145,7 @@ public virtual async Task GetEnvironmentAsync(string projectName, stri } /// - /// [Protocol Method] Gets an environment + /// [Protocol Method] Gets an environment. /// /// /// @@ -223,7 +223,7 @@ public virtual Response GetCatalog(string projectName, string } /// - /// [Protocol Method] Gets the specified catalog within the project + /// [Protocol Method] Gets the specified catalog within the project. /// /// /// @@ -265,7 +265,7 @@ public virtual async Task GetCatalogAsync(string projectName, string c } /// - /// [Protocol Method] Gets the specified catalog within the project + /// [Protocol Method] Gets the specified catalog within the project. /// /// /// @@ -919,7 +919,7 @@ public virtual Pageable GetEnvironmentDefinitionsByCatalog(string pr } /// Lists all environment types configured for a project. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -935,7 +935,7 @@ public virtual AsyncPageable GetEnvironmentTypesAsync( } /// Lists all environment types configured for a project. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -965,7 +965,7 @@ public virtual Pageable GetEnvironmentTypes(string pro /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. @@ -996,7 +996,7 @@ public virtual AsyncPageable GetEnvironmentTypesAsync(string project /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs index e657c7524da0..2293aca62b78 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs @@ -97,7 +97,7 @@ public virtual Response GetPool(string projectName, string poolName, } /// - /// [Protocol Method] Gets a pool + /// [Protocol Method] Gets a pool. /// /// /// @@ -139,7 +139,7 @@ public virtual async Task GetPoolAsync(string projectName, string pool } /// - /// [Protocol Method] Gets a pool + /// [Protocol Method] Gets a pool. /// /// /// @@ -345,7 +345,7 @@ public virtual Response GetDevBox(string projectName, string userId, str } /// - /// [Protocol Method] Gets a Dev Box + /// [Protocol Method] Gets a Dev Box. /// /// /// @@ -389,7 +389,7 @@ public virtual async Task GetDevBoxAsync(string projectName, string us } /// - /// [Protocol Method] Gets a Dev Box + /// [Protocol Method] Gets a Dev Box. /// /// /// @@ -471,7 +471,7 @@ public virtual Response GetRemoteConnection(string projectName } /// - /// [Protocol Method] Gets RDP Connection info + /// [Protocol Method] Gets RDP Connection info. /// /// /// @@ -515,7 +515,7 @@ public virtual async Task GetRemoteConnectionAsync(string projectName, } /// - /// [Protocol Method] Gets RDP Connection info + /// [Protocol Method] Gets RDP Connection info. /// /// /// @@ -781,7 +781,7 @@ public virtual Response SkipAction(string projectName, string userId, string dev /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. /// The name of the action. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -803,7 +803,7 @@ public virtual async Task> DelayActionAsync(string projec /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. /// The name of the action. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -839,7 +839,7 @@ public virtual Response DelayAction(string projectName, string use /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. /// The name of the action. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -886,7 +886,7 @@ public virtual async Task DelayActionAsync(string projectName, string /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. /// The name of the action. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -947,7 +947,7 @@ public virtual Pageable GetPools(string projectName, CancellationTok } /// - /// [Protocol Method] Lists available pools + /// [Protocol Method] Lists available pools. /// /// /// @@ -978,7 +978,7 @@ public virtual AsyncPageable GetPoolsAsync(string projectName, Reque } /// - /// [Protocol Method] Lists available pools + /// [Protocol Method] Lists available pools. /// /// /// @@ -1008,9 +1008,9 @@ public virtual Pageable GetPools(string projectName, RequestContext return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetPools", "value", "nextLink", context); } - /// Lists available schedules for a pool. - /// Name of the project. - /// Pool name. + /// Lists all schedules within a pool that are configured by your project administrator. + /// The DevCenter Project upon which to execute operations. + /// The name of a pool of Dev Boxes. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -1026,9 +1026,9 @@ public virtual AsyncPageable GetSchedulesAsync(string projectNam return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBoxSchedule.DeserializeDevBoxSchedule(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedules", "value", "nextLink", context); } - /// Lists available schedules for a pool. - /// Name of the project. - /// Pool name. + /// Lists all schedules within a pool that are configured by your project administrator. + /// The DevCenter Project upon which to execute operations. + /// The name of a pool of Dev Boxes. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -1045,7 +1045,7 @@ public virtual Pageable GetSchedules(string projectName, string } /// - /// [Protocol Method] Lists available schedules for a pool. + /// [Protocol Method] Lists all schedules within a pool that are configured by your project administrator. /// /// /// @@ -1059,8 +1059,8 @@ public virtual Pageable GetSchedules(string projectName, string /// /// /// - /// Name of the project. - /// Pool name. + /// The DevCenter Project upon which to execute operations. + /// The name of a pool of Dev Boxes. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -1078,7 +1078,7 @@ public virtual AsyncPageable GetSchedulesAsync(string projectName, s } /// - /// [Protocol Method] Lists available schedules for a pool. + /// [Protocol Method] Lists all schedules within a pool that are configured by your project administrator. /// /// /// @@ -1092,8 +1092,8 @@ public virtual AsyncPageable GetSchedulesAsync(string projectName, s /// /// /// - /// Name of the project. - /// Pool name. + /// The DevCenter Project upon which to execute operations. + /// The name of a pool of Dev Boxes. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -1494,7 +1494,7 @@ public virtual Pageable GetDevBoxActions(string projectName, string /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1515,7 +1515,7 @@ public virtual AsyncPageable DelayAllActionsAsync(strin /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1550,7 +1550,7 @@ public virtual Pageable DelayAllActions(string projectN /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1586,7 +1586,7 @@ public virtual AsyncPageable DelayAllActionsAsync(string projectName /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// Display name for the Dev Box. - /// The time to delay the Dev Box action or actions until. + /// The time to delay the Dev Box action or actions until, in RFC3339 format. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1615,7 +1615,7 @@ public virtual Pageable DelayAllActions(string projectName, string u /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute the operation. + /// The DevCenter Project upon which to execute operations. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// The name of a Dev Box. /// The content to send as the body of the request. @@ -1657,7 +1657,7 @@ public virtual async Task> CreateDevBoxAsync(WaitUntil wai /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute the operation. + /// The DevCenter Project upon which to execute operations. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// The name of a Dev Box. /// The content to send as the body of the request. @@ -1772,7 +1772,7 @@ public virtual Operation DeleteDevBox(WaitUntil waitUntil, string projectName, s // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Starts a Dev Box + /// [Protocol Method] Starts a Dev Box. /// /// /// @@ -1813,7 +1813,7 @@ public virtual async Task StartDevBoxAsync(WaitUntil waitUntil, strin // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Starts a Dev Box + /// [Protocol Method] Starts a Dev Box. /// /// /// @@ -1854,7 +1854,7 @@ public virtual Operation StartDevBox(WaitUntil waitUntil, string projectName, st // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Stops a Dev Box + /// [Protocol Method] Stops a Dev Box. /// /// /// @@ -1896,7 +1896,7 @@ public virtual async Task StopDevBoxAsync(WaitUntil waitUntil, string // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Stops a Dev Box + /// [Protocol Method] Stops a Dev Box. /// /// /// @@ -1938,7 +1938,7 @@ public virtual Operation StopDevBox(WaitUntil waitUntil, string projectName, str // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Restarts a Dev Box + /// [Protocol Method] Restarts a Dev Box. /// /// /// @@ -1979,7 +1979,7 @@ public virtual async Task RestartDevBoxAsync(WaitUntil waitUntil, str // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Restarts a Dev Box + /// [Protocol Method] Restarts a Dev Box. /// /// /// diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterModelFactory.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterModelFactory.cs index ea10b8dc1251..31af969b8fd0 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterModelFactory.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterModelFactory.cs @@ -85,7 +85,7 @@ public static OSDisk OSDisk(int? diskSizeGB = null) /// The version of the image. /// The operating system of the image. /// The operating system build number of the image. - /// The datetime that the backing image version was published. + /// The datetime that the backing image version was published, in RFC3339 format. /// A new instance for mocking. public static DevBoxImageReference DevBoxImageReference(string name = null, string version = null, string operatingSystem = null, string osBuildNumber = null, DateTimeOffset? publishedDate = null) { @@ -156,7 +156,7 @@ public static DevBoxSchedule DevBoxSchedule(string name = null, ScheduleType sch /// Information about the Dev Box's hardware resources. /// Storage settings for this Dev Box. /// Information about the image used for this Dev Box. - /// Creation time of this Dev Box. + /// Creation time of this Dev Box, in RFC3339 format. /// Indicates whether the owner of the Dev Box is a local administrator. /// A new instance for mocking. public static DevBox DevBox(string name = null, string projectName = null, string poolName = null, HibernateSupport? hibernateSupport = null, DevBoxProvisioningState? provisioningState = null, string actionState = null, PowerState? powerState = null, Guid? uniqueId = null, ResponseError error = null, AzureLocation? location = null, DevBoxOSType? osType = null, Guid? userId = null, DevBoxHardwareProfile hardwareProfile = null, DevBoxStorageProfile storageProfile = null, DevBoxImageReference imageReference = null, DateTimeOffset? createdTime = null, LocalAdministratorStatus? localAdministratorStatus = null) @@ -195,7 +195,7 @@ public static RemoteConnection RemoteConnection(Uri webUri = null, Uri rdpConnec /// The name of the action. /// The action that will be taken. /// The id of the resource which triggered this action. - /// The earliest time that the action could occur (UTC). + /// The earliest time that the action could occur (UTC), in RFC3339 format. /// Details about the next run of this action. /// A new instance for mocking. public static DevBoxAction DevBoxAction(string name = null, DevBoxActionType actionType = default, string sourceId = null, DateTimeOffset? suspendedUntil = null, DevBoxNextAction nextAction = null) @@ -210,7 +210,7 @@ public static DevBoxAction DevBoxAction(string name = null, DevBoxActionType act } /// Initializes a new instance of . - /// The time the action will be triggered (UTC). + /// The time the action will be triggered (UTC), in RFC3339 format. /// A new instance for mocking. public static DevBoxNextAction DevBoxNextAction(DateTimeOffset scheduledTime = default) { @@ -295,7 +295,7 @@ public static EnvironmentDefinition EnvironmentDefinition(string id = null, stri /// Default value of the parameter. /// /// A string of one of the basic JSON types (number, integer, array, object, - /// boolean, string) + /// boolean, string). /// /// /// Whether or not this parameter is read-only. If true, default should have a diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.Serialization.cs index 43a87aa9c94b..40fcc133d197 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.Serialization.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.Serialization.cs @@ -111,7 +111,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("createdTime"u8); writer.WriteStringValue(CreatedTime.Value, "O"); } - if (Optional.IsDefined(LocalAdministratorStatus)) + if (options.Format != "W" && Optional.IsDefined(LocalAdministratorStatus)) { writer.WritePropertyName("localAdministrator"u8); writer.WriteStringValue(LocalAdministratorStatus.Value.ToString()); diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.cs index 57e8e92069bb..a17ff734bb3f 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.cs @@ -71,7 +71,7 @@ public partial class DevBox /// Information about the Dev Box's hardware resources. /// Storage settings for this Dev Box. /// Information about the image used for this Dev Box. - /// Creation time of this Dev Box. + /// Creation time of this Dev Box, in RFC3339 format. /// Indicates whether the owner of the Dev Box is a local administrator. /// Keeps track of any properties unknown to the library. internal DevBox(string name, string projectName, string poolName, HibernateSupport? hibernateSupport, DevBoxProvisioningState? provisioningState, string actionState, PowerState? powerState, Guid? uniqueId, ResponseError error, AzureLocation? location, DevBoxOSType? osType, Guid? userId, DevBoxHardwareProfile hardwareProfile, DevBoxStorageProfile storageProfile, DevBoxImageReference imageReference, DateTimeOffset? createdTime, LocalAdministratorStatus? localAdministratorStatus, IDictionary serializedAdditionalRawData) @@ -140,9 +140,9 @@ internal DevBox() public DevBoxStorageProfile StorageProfile { get; } /// Information about the image used for this Dev Box. public DevBoxImageReference ImageReference { get; } - /// Creation time of this Dev Box. + /// Creation time of this Dev Box, in RFC3339 format. public DateTimeOffset? CreatedTime { get; } /// Indicates whether the owner of the Dev Box is a local administrator. - public LocalAdministratorStatus? LocalAdministratorStatus { get; set; } + public LocalAdministratorStatus? LocalAdministratorStatus { get; } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.cs index c204cd48b228..c5f0e218e802 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.cs @@ -61,7 +61,7 @@ internal DevBoxAction(DevBoxActionType actionType, string sourceId) /// The name of the action. /// The action that will be taken. /// The id of the resource which triggered this action. - /// The earliest time that the action could occur (UTC). + /// The earliest time that the action could occur (UTC), in RFC3339 format. /// Details about the next run of this action. /// Keeps track of any properties unknown to the library. internal DevBoxAction(string name, DevBoxActionType actionType, string sourceId, DateTimeOffset? suspendedUntil, DevBoxNextAction nextAction, IDictionary serializedAdditionalRawData) @@ -85,7 +85,7 @@ internal DevBoxAction() public DevBoxActionType ActionType { get; } /// The id of the resource which triggered this action. public string SourceId { get; } - /// The earliest time that the action could occur (UTC). + /// The earliest time that the action could occur (UTC), in RFC3339 format. public DateTimeOffset? SuspendedUntil { get; } /// Details about the next run of this action. public DevBoxNextAction NextAction { get; } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.cs index f007cf201494..1d98878c22cc 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.cs @@ -55,7 +55,7 @@ public DevBoxImageReference() /// The version of the image. /// The operating system of the image. /// The operating system build number of the image. - /// The datetime that the backing image version was published. + /// The datetime that the backing image version was published, in RFC3339 format. /// Keeps track of any properties unknown to the library. internal DevBoxImageReference(string name, string version, string operatingSystem, string osBuildNumber, DateTimeOffset? publishedDate, IDictionary serializedAdditionalRawData) { @@ -75,7 +75,7 @@ internal DevBoxImageReference(string name, string version, string operatingSyste public string OperatingSystem { get; } /// The operating system build number of the image. public string OSBuildNumber { get; } - /// The datetime that the backing image version was published. + /// The datetime that the backing image version was published, in RFC3339 format. public DateTimeOffset? PublishedDate { get; } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.cs index 7abeb1fff11c..3e6d5cad2f7e 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.cs @@ -46,14 +46,14 @@ public partial class DevBoxNextAction private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// The time the action will be triggered (UTC). + /// The time the action will be triggered (UTC), in RFC3339 format. internal DevBoxNextAction(DateTimeOffset scheduledTime) { ScheduledTime = scheduledTime; } /// Initializes a new instance of . - /// The time the action will be triggered (UTC). + /// The time the action will be triggered (UTC), in RFC3339 format. /// Keeps track of any properties unknown to the library. internal DevBoxNextAction(DateTimeOffset scheduledTime, IDictionary serializedAdditionalRawData) { @@ -66,7 +66,7 @@ internal DevBoxNextAction() { } - /// The time the action will be triggered (UTC). + /// The time the action will be triggered (UTC), in RFC3339 format. public DateTimeOffset ScheduledTime { get; } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.Serialization.cs index 62fcee8f6929..aead4c8ac388 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.Serialization.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.Serialization.cs @@ -34,8 +34,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(DevCenterEnvironmentType)} does not support writing '{format}' format."); } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } writer.WritePropertyName("deploymentTargetId"u8); writer.WriteStringValue(DeploymentTargetId); writer.WritePropertyName("status"u8); diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.cs index a9d9a7bb8d38..7ab4e428ebf5 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.cs @@ -47,20 +47,17 @@ public partial class DevCenterEnvironmentType private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// Name of the environment type. /// /// Id of a subscription or management group that the environment type will be /// mapped to. The environment's resources will be deployed into this subscription /// or management group. /// /// Indicates whether this environment type is enabled for use in this project. - /// or is null. - internal DevCenterEnvironmentType(string name, ResourceIdentifier deploymentTargetId, EnvironmentTypeStatus status) + /// is null. + internal DevCenterEnvironmentType(ResourceIdentifier deploymentTargetId, EnvironmentTypeStatus status) { - Argument.AssertNotNull(name, nameof(name)); Argument.AssertNotNull(deploymentTargetId, nameof(deploymentTargetId)); - Name = name; DeploymentTargetId = deploymentTargetId; Status = status; } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.cs index c67ea98e4a76..22fe93a82fe5 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.cs @@ -49,7 +49,7 @@ public partial class EnvironmentDefinitionParameter /// Unique ID of the parameter. /// /// A string of one of the basic JSON types (number, integer, array, object, - /// boolean, string) + /// boolean, string). /// /// Whether or not this parameter is required. /// is null. @@ -70,7 +70,7 @@ internal EnvironmentDefinitionParameter(string id, EnvironmentDefinitionParamete /// Default value of the parameter. /// /// A string of one of the basic JSON types (number, integer, array, object, - /// boolean, string) + /// boolean, string). /// /// /// Whether or not this parameter is read-only. If true, default should have a @@ -107,7 +107,7 @@ internal EnvironmentDefinitionParameter() public string DefaultValue { get; } /// /// A string of one of the basic JSON types (number, integer, array, object, - /// boolean, string) + /// boolean, string). /// public EnvironmentDefinitionParameterType ParameterType { get; } /// diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs index 3bac6833b92d..fc4ba880bfc1 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs @@ -479,7 +479,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitionsB [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject() + public void Example_EnvironmentType_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -496,7 +496,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentTypes_ListsAllEnvi [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject_Async() + public async Task Example_EnvironmentType_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -513,7 +513,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_ListsA [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject_Convenience() + public void Example_EnvironmentType_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -526,7 +526,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentTypes_ListsAllEnvi [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject_Convenience_Async() + public async Task Example_EnvironmentType_GetEnvironmentTypes_ListsAllEnvironmentTypesConfiguredForAProject_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs index 227fde00f705..35a98bd001e3 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs @@ -427,7 +427,7 @@ public async Task Example_Pool_GetPools_ListsAvailablePools_Convenience_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_Schedule_GetSchedules_ListsAvailableSchedulesForAPool() + public void Example_DevBoxesClientOperations_GetSchedules_ListsAvailableSchedulesForAPool() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -446,7 +446,7 @@ public void Example_Schedule_GetSchedules_ListsAvailableSchedulesForAPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Schedule_GetSchedules_ListsAvailableSchedulesForAPool_Async() + public async Task Example_DevBoxesClientOperations_GetSchedules_ListsAvailableSchedulesForAPool_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -465,7 +465,7 @@ public async Task Example_Schedule_GetSchedules_ListsAvailableSchedulesForAPool_ [Test] [Ignore("Only validating compilation of examples")] - public void Example_Schedule_GetSchedules_ListsAvailableSchedulesForAPool_Convenience() + public void Example_DevBoxesClientOperations_GetSchedules_ListsAvailableSchedulesForAPool_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -478,7 +478,7 @@ public void Example_Schedule_GetSchedules_ListsAvailableSchedulesForAPool_Conven [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Schedule_GetSchedules_ListsAvailableSchedulesForAPool_Convenience_Async() + public async Task Example_DevBoxesClientOperations_GetSchedules_ListsAvailableSchedulesForAPool_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml b/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml index a35b3657c38d..f514a0608d19 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml +++ b/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/devcenter/DevCenter -commit: f7cabc8b022405805ee350001ee507ff3a56c546 +commit: f79d4ed573ec12a63917b01e54baeaa52a914f3f repo: Azure/azure-rest-api-specs -cleanup: false +additionalDirectories: diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs index 3c74552a2652..543f92175321 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; namespace Azure.AI.Vision.Face @@ -299,239 +300,206 @@ public static FaceIdentificationCandidate FaceIdentificationCandidate(Guid perso /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. /// A new instance for mocking. - public static CreateLivenessSessionContent CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode = default, bool? sendResultsToClient = null, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessSingleModalModel = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null) + public static CreateLivenessSessionContent CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode = default, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessModelVersion = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null) { return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// A new instance for mocking. - public static CreateLivenessSessionResult CreateLivenessSessionResult(string sessionId = null, string authToken = null) - { - return new CreateLivenessSessionResult(sessionId, authToken, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness session. /// A new instance for mocking. - public static LivenessSession LivenessSession(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, FaceSessionStatus status = default, LivenessSessionAuditEntry result = null) + public static LivenessSession LivenessSession(string sessionId = null, string authToken = null, OperationState status = default, LivenessModel? modelVersion = null, LivenessSessionResults results = null) { return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - /// The UTC DateTime that the request was received. - /// The request of this entry. - /// The response of this entry. - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - /// The image ID of the session request. - /// The sha256 hash of the verify-image in the request. - /// A new instance for mocking. - public static LivenessSessionAuditEntry LivenessSessionAuditEntry(long id = default, string sessionId = null, string requestId = null, string clientRequestId = null, DateTimeOffset receivedDateTime = default, AuditRequestInfo request = null, AuditLivenessResponseInfo response = null, string digest = null, string sessionImageId = null, string verifyImageHash = null) + /// Initializes a new instance of . + /// The attempts data of underlying liveness call with the session. + /// A new instance for mocking. + public static LivenessSessionResults LivenessSessionResults(IEnumerable attempts = null) { - return new LivenessSessionAuditEntry( - id, - sessionId, - requestId, - clientRequestId, - receivedDateTime, - request, - response, - digest, - sessionImageId, - verifyImageHash, - serializedAdditionalRawData: null); - } + attempts ??= new List(); - /// Initializes a new instance of . - /// The relative URL and query of the liveness request. - /// The HTTP method of the request (i.e., GET, POST, DELETE). - /// The length of the request body in bytes. - /// The content type of the request. - /// The user agent used to submit the request. - /// A new instance for mocking. - public static AuditRequestInfo AuditRequestInfo(string url = null, string method = null, long? contentLength = null, string contentType = null, string userAgent = null) - { - return new AuditRequestInfo( - url, - method, - contentLength, - contentType, - userAgent, - serializedAdditionalRawData: null); + return new LivenessSessionResults(attempts?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The response body. The schema of this field will depend on the request.url and request.method used by the client. - /// The HTTP status code returned to the client. - /// The server measured latency for this request in milliseconds. - /// A new instance for mocking. - public static AuditLivenessResponseInfo AuditLivenessResponseInfo(LivenessResponseBody body = null, int statusCode = default, long latencyInMilliseconds = default) + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness call, will be null if there is error. + /// The error of the liveness call, will be null if there is result. + /// A new instance for mocking. + public static LivenessSessionAttempt LivenessSessionAttempt(int attemptId = default, OperationState attemptStatus = default, LivenessResult result = null, LivenessError error = null) { - return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData: null); + return new LivenessSessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The liveness classification for the target face. - /// Specific targets used for liveness classification. - /// The model version used for liveness classification. - /// The face verification output. Only available when the request is liveness with verify. - /// Additional Properties. - /// A new instance for mocking. - public static LivenessResponseBody LivenessResponseBody(FaceLivenessDecision? livenessDecision = null, LivenessOutputsTarget target = null, LivenessModel? modelVersionUsed = null, LivenessWithVerifyOutputs verifyResult = null, IReadOnlyDictionary additionalProperties = null) - { - additionalProperties ??= new Dictionary(); - - return new LivenessResponseBody(livenessDecision, target, modelVersionUsed, verifyResult, additionalProperties); - } - - /// Initializes a new instance of . - /// The face region where the liveness classification was made on. - /// The file name which contains the face rectangle where the liveness classification was made on. - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - /// The image type which contains the face rectangle where the liveness classification was made on. - /// A new instance for mocking. - public static LivenessOutputsTarget LivenessOutputsTarget(FaceRectangle faceRectangle = null, string fileName = null, int timeOffsetWithinFile = default, FaceImageType imageType = default) + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// A new instance for mocking. + public static LivenessResult LivenessResult(FaceLivenessDecision? livenessDecision = null, LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null) { - return new LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, serializedAdditionalRawData: null); + return new LivenessResult(livenessDecision, targets, digest, sessionImageId, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The detail of face for verification. - /// The target face liveness face and comparison image face verification confidence. - /// Whether the target liveness face and comparison image face match. - /// A new instance for mocking. - public static LivenessWithVerifyOutputs LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage = null, float matchConfidence = default, bool isIdentical = default) + /// Initializes a new instance of . + /// The target from color image used for liveness classification. + /// A new instance for mocking. + public static LivenessDecisionTargets LivenessDecisionTargets(LivenessColorDecisionTarget color = null) { - return new LivenessWithVerifyOutputs(verifyImage, matchConfidence, isIdentical, serializedAdditionalRawData: null); + return new LivenessDecisionTargets(color, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The face region where the comparison image's classification was made. - /// Quality of face image for recognition. - /// A new instance for mocking. - public static LivenessWithVerifyImage LivenessWithVerifyImage(FaceRectangle faceRectangle = null, QualityForRecognition qualityForRecognition = default) + /// Initializes a new instance of . + /// The face region where the liveness classification was made on. + /// A new instance for mocking. + public static LivenessColorDecisionTarget LivenessColorDecisionTarget(FaceRectangle faceRectangle = null) { - return new LivenessWithVerifyImage(faceRectangle, qualityForRecognition, serializedAdditionalRawData: null); + return new LivenessColorDecisionTarget(faceRectangle, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - /// A new instance for mocking. - public static LivenessSessionItem LivenessSessionItem(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null) + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// Targets used for liveness classification. + /// A new instance for mocking. + public static LivenessError LivenessError(string code = null, string message = null, LivenessDecisionTargets targets = null) { - return new LivenessSessionItem( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, - serializedAdditionalRawData: null); + return new LivenessError(code, message, targets, serializedAdditionalRawData: null); } /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// Whether or not return the verify image hash. + /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score. + /// The image stream for verify. Content-Disposition header field for this part must have filename. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - /// Whether or not return the verify image hash. - /// Threshold for confidence of the face verification. /// A new instance for mocking. - public static CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode = default, bool? sendResultsToClient = null, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessSingleModalModel = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, bool? returnVerifyImageHash = null, float? verifyConfidenceThreshold = null) + public static CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode = default, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessModelVersion = null, bool? returnVerifyImageHash = null, float? verifyConfidenceThreshold = null, Stream verifyImage = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null) { return new CreateLivenessWithVerifySessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + livenessModelVersion, returnVerifyImageHash, verifyConfidenceThreshold, + verifyImage, + deviceCorrelationId, + authTokenTimeToLiveInSeconds, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// The detail of face for verification. - /// A new instance for mocking. - public static CreateLivenessWithVerifySessionResult CreateLivenessWithVerifySessionResult(string sessionId = null, string authToken = null, LivenessWithVerifyImage verifyImage = null) - { - return new CreateLivenessWithVerifySessionResult(sessionId, authToken, verifyImage, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness with verify session. /// A new instance for mocking. - public static LivenessWithVerifySession LivenessWithVerifySession(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, FaceSessionStatus status = default, LivenessSessionAuditEntry result = null) + public static LivenessWithVerifySession LivenessWithVerifySession(string sessionId = null, string authToken = null, OperationState status = default, LivenessModel? modelVersion = null, LivenessWithVerifySessionResults results = null) { return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// A new instance for mocking. + public static LivenessWithVerifySessionResults LivenessWithVerifySessionResults(IEnumerable verifyReferences = null, IEnumerable attempts = null) + { + verifyReferences ??= new List(); + attempts ??= new List(); + + return new LivenessWithVerifySessionResults(verifyReferences?.ToList(), attempts?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The image type which contains the face rectangle where the liveness classification was made on. + /// The face region where the comparison image's classification was made. + /// Quality of face image for recognition. + /// A new instance for mocking. + public static LivenessWithVerifyReference LivenessWithVerifyReference(FaceImageType referenceType = default, FaceRectangle faceRectangle = null, QualityForRecognition qualityForRecognition = default) + { + return new LivenessWithVerifyReference(referenceType, faceRectangle, qualityForRecognition, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness with verify call, will be null if there is error. + /// The error of the liveness with verify call, will be null if there is result. + /// A new instance for mocking. + public static LivenessWithVerifySessionAttempt LivenessWithVerifySessionAttempt(int attemptId = default, OperationState attemptStatus = default, LivenessWithVerifyResult result = null, LivenessError error = null) + { + return new LivenessWithVerifySessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The liveness classification for the target face. + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// The face verification output. Only available when the request is liveness with verify. + /// The sha256 hash of the verify-image in the request. + /// A new instance for mocking. + public static LivenessWithVerifyResult LivenessWithVerifyResult(FaceLivenessDecision? livenessDecision = null, LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null, LivenessWithVerifyOutputs verifyResult = null, string verifyImageHash = null) + { + return new LivenessWithVerifyResult( + livenessDecision, + targets, + digest, + sessionImageId, + verifyResult, + verifyImageHash, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The target face liveness face and comparison image face verification confidence. + /// Whether the target liveness face and comparison image face match. + /// A new instance for mocking. + public static LivenessWithVerifyOutputs LivenessWithVerifyOutputs(float matchConfidence = default, bool isIdentical = default) + { + return new LivenessWithVerifyOutputs(matchConfidence, isIdentical, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// User defined name, maximum length is 128. /// Optional user defined data. Length should not exceed 16K. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs deleted file mode 100644 index 3448b284f8e3..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// Audit entry for a response in the session. - public partial class AuditLivenessResponseInfo - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The response body. The schema of this field will depend on the request.url and request.method used by the client. - /// The HTTP status code returned to the client. - /// The server measured latency for this request in milliseconds. - /// is null. - internal AuditLivenessResponseInfo(LivenessResponseBody body, int statusCode, long latencyInMilliseconds) - { - Argument.AssertNotNull(body, nameof(body)); - - Body = body; - StatusCode = statusCode; - LatencyInMilliseconds = latencyInMilliseconds; - } - - /// Initializes a new instance of . - /// The response body. The schema of this field will depend on the request.url and request.method used by the client. - /// The HTTP status code returned to the client. - /// The server measured latency for this request in milliseconds. - /// Keeps track of any properties unknown to the library. - internal AuditLivenessResponseInfo(LivenessResponseBody body, int statusCode, long latencyInMilliseconds, IDictionary serializedAdditionalRawData) - { - Body = body; - StatusCode = statusCode; - LatencyInMilliseconds = latencyInMilliseconds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AuditLivenessResponseInfo() - { - } - - /// The response body. The schema of this field will depend on the request.url and request.method used by the client. - public LivenessResponseBody Body { get; } - /// The HTTP status code returned to the client. - public int StatusCode { get; } - /// The server measured latency for this request in milliseconds. - public long LatencyInMilliseconds { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs deleted file mode 100644 index 39356d1eb8f8..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// Audit entry for a request in the session. - public partial class AuditRequestInfo - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The relative URL and query of the liveness request. - /// The HTTP method of the request (i.e., GET, POST, DELETE). - /// The content type of the request. - /// , or is null. - internal AuditRequestInfo(string url, string method, string contentType) - { - Argument.AssertNotNull(url, nameof(url)); - Argument.AssertNotNull(method, nameof(method)); - Argument.AssertNotNull(contentType, nameof(contentType)); - - Url = url; - Method = method; - ContentType = contentType; - } - - /// Initializes a new instance of . - /// The relative URL and query of the liveness request. - /// The HTTP method of the request (i.e., GET, POST, DELETE). - /// The length of the request body in bytes. - /// The content type of the request. - /// The user agent used to submit the request. - /// Keeps track of any properties unknown to the library. - internal AuditRequestInfo(string url, string method, long? contentLength, string contentType, string userAgent, IDictionary serializedAdditionalRawData) - { - Url = url; - Method = method; - ContentLength = contentLength; - ContentType = contentType; - UserAgent = userAgent; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AuditRequestInfo() - { - } - - /// The relative URL and query of the liveness request. - public string Url { get; } - /// The HTTP method of the request (i.e., GET, POST, DELETE). - public string Method { get; } - /// The length of the request body in bytes. - public long? ContentLength { get; } - /// The content type of the request. - public string ContentType { get; } - /// The user agent used to submit the request. - public string UserAgent { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs index a27f25f2a008..6790ac937886 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Vision.Face /// Client options for Azure.AI.Vision.Face library clients. public partial class AzureAIVisionFaceClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V1_2_Preview_1; + private const ServiceVersion LatestVersion = ServiceVersion.V1_2; /// The version of the service to use. public enum ServiceVersion @@ -22,6 +22,8 @@ public enum ServiceVersion V1_1_Preview_1 = 1, /// Service version "v1.2-preview.1". V1_2_Preview_1 = 2, + /// Service version "v1.2". + V1_2 = 3, } internal string Version { get; } @@ -33,6 +35,7 @@ public AzureAIVisionFaceClientOptions(ServiceVersion version = LatestVersion) { ServiceVersion.V1_1_Preview_1 => "v1.1-preview.1", ServiceVersion.V1_2_Preview_1 => "v1.2-preview.1", + ServiceVersion.V1_2 => "v1.2", _ => throw new NotSupportedException() }; } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs index 4c6879d0bbf9..a7d64fe5bb32 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs @@ -36,11 +36,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("livenessOperationMode"u8); writer.WriteStringValue(LivenessOperationMode.ToString()); - if (Optional.IsDefined(SendResultsToClient)) - { - writer.WritePropertyName("sendResultsToClient"u8); - writer.WriteBooleanValue(SendResultsToClient.Value); - } if (Optional.IsDefined(DeviceCorrelationIdSetInClient)) { writer.WritePropertyName("deviceCorrelationIdSetInClient"u8); @@ -51,10 +46,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enableSessionImage"u8); writer.WriteBooleanValue(EnableSessionImage.Value); } - if (Optional.IsDefined(LivenessSingleModalModel)) + if (Optional.IsDefined(LivenessModelVersion)) { - writer.WritePropertyName("livenessSingleModalModel"u8); - writer.WriteStringValue(LivenessSingleModalModel.Value.ToString()); + writer.WritePropertyName("livenessModelVersion"u8); + writer.WriteStringValue(LivenessModelVersion.Value.ToString()); } if (Optional.IsDefined(DeviceCorrelationId)) { @@ -104,10 +99,9 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon return null; } LivenessOperationMode livenessOperationMode = default; - bool? sendResultsToClient = default; bool? deviceCorrelationIdSetInClient = default; bool? enableSessionImage = default; - LivenessModel? livenessSingleModalModel = default; + LivenessModel? livenessModelVersion = default; string deviceCorrelationId = default; int? authTokenTimeToLiveInSeconds = default; IDictionary serializedAdditionalRawData = default; @@ -119,15 +113,6 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon livenessOperationMode = new LivenessOperationMode(property.Value.GetString()); continue; } - if (property.NameEquals("sendResultsToClient"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sendResultsToClient = property.Value.GetBoolean(); - continue; - } if (property.NameEquals("deviceCorrelationIdSetInClient"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -146,13 +131,13 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon enableSessionImage = property.Value.GetBoolean(); continue; } - if (property.NameEquals("livenessSingleModalModel"u8)) + if (property.NameEquals("livenessModelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - livenessSingleModalModel = new LivenessModel(property.Value.GetString()); + livenessModelVersion = new LivenessModel(property.Value.GetString()); continue; } if (property.NameEquals("deviceCorrelationId"u8)) @@ -177,10 +162,9 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon serializedAdditionalRawData = rawDataDictionary; return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, serializedAdditionalRawData); diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs index 9de38ee841c6..66e9ce0ec227 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs @@ -54,20 +54,18 @@ public CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode) /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. /// Keeps track of any properties unknown to the library. - internal CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode, bool? sendResultsToClient, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessSingleModalModel, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) + internal CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessModelVersion, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) { LivenessOperationMode = livenessOperationMode; - SendResultsToClient = sendResultsToClient; DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient; EnableSessionImage = enableSessionImage; - LivenessSingleModalModel = livenessSingleModalModel; + LivenessModelVersion = livenessModelVersion; DeviceCorrelationId = deviceCorrelationId; AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -80,14 +78,12 @@ internal CreateLivenessSessionContent() /// Type of liveness mode the client should follow. public LivenessOperationMode LivenessOperationMode { get; } - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. - public bool? SendResultsToClient { get; set; } /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. public bool? DeviceCorrelationIdSetInClient { get; set; } /// Whether or not store the session image. public bool? EnableSessionImage { get; set; } /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. - public LivenessModel? LivenessSingleModalModel { get; set; } + public LivenessModel? LivenessModelVersion { get; set; } /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. public string DeviceCorrelationId { get; set; } /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs deleted file mode 100644 index cf8e5b8e2c7f..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// Response of liveness session creation. - public partial class CreateLivenessSessionResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// or is null. - internal CreateLivenessSessionResult(string sessionId, string authToken) - { - Argument.AssertNotNull(sessionId, nameof(sessionId)); - Argument.AssertNotNull(authToken, nameof(authToken)); - - SessionId = sessionId; - AuthToken = authToken; - } - - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// Keeps track of any properties unknown to the library. - internal CreateLivenessSessionResult(string sessionId, string authToken, IDictionary serializedAdditionalRawData) - { - SessionId = sessionId; - AuthToken = authToken; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateLivenessSessionResult() - { - } - - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - public string SessionId { get; } - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - public string AuthToken { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs index 27a9c425fb45..20c081c13629 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.IO; using System.Text.Json; using Azure.Core; @@ -36,11 +37,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("livenessOperationMode"u8); writer.WriteStringValue(LivenessOperationMode.ToString()); - if (Optional.IsDefined(SendResultsToClient)) - { - writer.WritePropertyName("sendResultsToClient"u8); - writer.WriteBooleanValue(SendResultsToClient.Value); - } if (Optional.IsDefined(DeviceCorrelationIdSetInClient)) { writer.WritePropertyName("deviceCorrelationIdSetInClient"u8); @@ -51,20 +47,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enableSessionImage"u8); writer.WriteBooleanValue(EnableSessionImage.Value); } - if (Optional.IsDefined(LivenessSingleModalModel)) + if (Optional.IsDefined(LivenessModelVersion)) { - writer.WritePropertyName("livenessSingleModalModel"u8); - writer.WriteStringValue(LivenessSingleModalModel.Value.ToString()); - } - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("livenessModelVersion"u8); + writer.WriteStringValue(LivenessModelVersion.Value.ToString()); } if (Optional.IsDefined(ReturnVerifyImageHash)) { @@ -76,6 +62,25 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("verifyConfidenceThreshold"u8); writer.WriteNumberValue(VerifyConfidenceThreshold.Value); } + writer.WritePropertyName("verifyImage"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(global::System.BinaryData.FromStream(VerifyImage)); +#else + using (JsonDocument document = JsonDocument.Parse(BinaryData.FromStream(VerifyImage), ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + if (Optional.IsDefined(DeviceCorrelationId)) + { + writer.WritePropertyName("deviceCorrelationId"u8); + writer.WriteStringValue(DeviceCorrelationId); + } + if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) + { + writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); + writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -114,14 +119,14 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness return null; } LivenessOperationMode livenessOperationMode = default; - bool? sendResultsToClient = default; bool? deviceCorrelationIdSetInClient = default; bool? enableSessionImage = default; - LivenessModel? livenessSingleModalModel = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; + LivenessModel? livenessModelVersion = default; bool? returnVerifyImageHash = default; float? verifyConfidenceThreshold = default; + Stream verifyImage = default; + string deviceCorrelationId = default; + int? authTokenTimeToLiveInSeconds = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -131,15 +136,6 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness livenessOperationMode = new LivenessOperationMode(property.Value.GetString()); continue; } - if (property.NameEquals("sendResultsToClient"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sendResultsToClient = property.Value.GetBoolean(); - continue; - } if (property.NameEquals("deviceCorrelationIdSetInClient"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -158,45 +154,50 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness enableSessionImage = property.Value.GetBoolean(); continue; } - if (property.NameEquals("livenessSingleModalModel"u8)) + if (property.NameEquals("livenessModelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - livenessSingleModalModel = new LivenessModel(property.Value.GetString()); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) - { - deviceCorrelationId = property.Value.GetString(); + livenessModelVersion = new LivenessModel(property.Value.GetString()); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("returnVerifyImageHash"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); + returnVerifyImageHash = property.Value.GetBoolean(); continue; } - if (property.NameEquals("returnVerifyImageHash"u8)) + if (property.NameEquals("verifyConfidenceThreshold"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - returnVerifyImageHash = property.Value.GetBoolean(); + verifyConfidenceThreshold = property.Value.GetSingle(); continue; } - if (property.NameEquals("verifyConfidenceThreshold"u8)) + if (property.NameEquals("verifyImage"u8)) + { + verifyImage = BinaryData.FromString(property.Value.GetRawText()).ToStream(); + continue; + } + if (property.NameEquals("deviceCorrelationId"u8)) + { + deviceCorrelationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - verifyConfidenceThreshold = property.Value.GetSingle(); + authTokenTimeToLiveInSeconds = property.Value.GetInt32(); continue; } if (options.Format != "W") @@ -207,17 +208,68 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness serializedAdditionalRawData = rawDataDictionary; return new CreateLivenessWithVerifySessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + livenessModelVersion, returnVerifyImageHash, verifyConfidenceThreshold, + verifyImage, + deviceCorrelationId, + authTokenTimeToLiveInSeconds, serializedAdditionalRawData); } + private BinaryData SerializeMultipart(ModelReaderWriterOptions options) + { + using MultipartFormDataRequestContent content = ToMultipartRequestContent(); + using MemoryStream stream = new MemoryStream(); + content.WriteTo(stream); + if (stream.Position > int.MaxValue) + { + return BinaryData.FromStream(stream); + } + else + { + return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position)); + } + } + + internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() + { + MultipartFormDataRequestContent content = new MultipartFormDataRequestContent(); + content.Add(LivenessOperationMode.ToString(), "livenessOperationMode"); + if (Optional.IsDefined(DeviceCorrelationIdSetInClient)) + { + content.Add(DeviceCorrelationIdSetInClient.Value, "deviceCorrelationIdSetInClient"); + } + if (Optional.IsDefined(EnableSessionImage)) + { + content.Add(EnableSessionImage.Value, "enableSessionImage"); + } + if (Optional.IsDefined(LivenessModelVersion)) + { + content.Add(LivenessModelVersion.Value.ToString(), "livenessModelVersion"); + } + if (Optional.IsDefined(ReturnVerifyImageHash)) + { + content.Add(ReturnVerifyImageHash.Value, "returnVerifyImageHash"); + } + if (Optional.IsDefined(VerifyConfidenceThreshold)) + { + content.Add(VerifyConfidenceThreshold.Value, "verifyConfidenceThreshold"); + } + content.Add(VerifyImage, "verifyImage", "verifyImage", "application/octet-stream"); + if (Optional.IsDefined(DeviceCorrelationId)) + { + content.Add(DeviceCorrelationId, "deviceCorrelationId"); + } + if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) + { + content.Add(AuthTokenTimeToLiveInSeconds.Value, "authTokenTimeToLiveInSeconds"); + } + return content; + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -226,6 +278,8 @@ BinaryData IPersistableModel.Write(Model { case "J": return ModelReaderWriter.Write(this, options); + case "MFD": + return SerializeMultipart(options); default: throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionContent)} does not support writing '{options.Format}' format."); } @@ -247,7 +301,7 @@ CreateLivenessWithVerifySessionContent IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs index 99e890eaf7e3..b0ce40c829f3 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.IO; namespace Azure.AI.Vision.Face { - /// Request for creating liveness with verify session. + /// Request of liveness with verify session creation. public partial class CreateLivenessWithVerifySessionContent { /// @@ -47,33 +48,38 @@ public partial class CreateLivenessWithVerifySessionContent /// Initializes a new instance of . /// Type of liveness mode the client should follow. - public CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode) + /// The image stream for verify. Content-Disposition header field for this part must have filename. + /// is null. + public CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, Stream verifyImage) { + Argument.AssertNotNull(verifyImage, nameof(verifyImage)); + LivenessOperationMode = livenessOperationMode; + VerifyImage = verifyImage; } /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// Whether or not return the verify image hash. + /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score. + /// The image stream for verify. Content-Disposition header field for this part must have filename. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - /// Whether or not return the verify image hash. - /// Threshold for confidence of the face verification. /// Keeps track of any properties unknown to the library. - internal CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, bool? sendResultsToClient, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessSingleModalModel, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, bool? returnVerifyImageHash, float? verifyConfidenceThreshold, IDictionary serializedAdditionalRawData) + internal CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessModelVersion, bool? returnVerifyImageHash, float? verifyConfidenceThreshold, Stream verifyImage, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) { LivenessOperationMode = livenessOperationMode; - SendResultsToClient = sendResultsToClient; DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient; EnableSessionImage = enableSessionImage; - LivenessSingleModalModel = livenessSingleModalModel; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + LivenessModelVersion = livenessModelVersion; ReturnVerifyImageHash = returnVerifyImageHash; VerifyConfidenceThreshold = verifyConfidenceThreshold; + VerifyImage = verifyImage; + DeviceCorrelationId = deviceCorrelationId; + AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -84,21 +90,21 @@ internal CreateLivenessWithVerifySessionContent() /// Type of liveness mode the client should follow. public LivenessOperationMode LivenessOperationMode { get; } - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. - public bool? SendResultsToClient { get; set; } /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. public bool? DeviceCorrelationIdSetInClient { get; set; } /// Whether or not store the session image. public bool? EnableSessionImage { get; set; } /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. - public LivenessModel? LivenessSingleModalModel { get; set; } + public LivenessModel? LivenessModelVersion { get; set; } + /// Whether or not return the verify image hash. + public bool? ReturnVerifyImageHash { get; set; } + /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score. + public float? VerifyConfidenceThreshold { get; set; } + /// The image stream for verify. Content-Disposition header field for this part must have filename. + public Stream VerifyImage { get; } /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. public string DeviceCorrelationId { get; set; } /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. public int? AuthTokenTimeToLiveInSeconds { get; set; } - /// Whether or not return the verify image hash. - public bool? ReturnVerifyImageHash { get; set; } - /// Threshold for confidence of the face verification. - public float? VerifyConfidenceThreshold { get; set; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs deleted file mode 100644 index edc3e7532592..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Vision.Face -{ - internal partial class CreateLivenessWithVerifySessionMultipartContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("Parameters"u8); - writer.WriteObjectValue(Parameters, options); - writer.WritePropertyName("VerifyImage"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(global::System.BinaryData.FromStream(VerifyImage)); -#else - using (JsonDocument document = JsonDocument.Parse(BinaryData.FromStream(VerifyImage), ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateLivenessWithVerifySessionMultipartContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement, options); - } - - internal static CreateLivenessWithVerifySessionMultipartContent DeserializeCreateLivenessWithVerifySessionMultipartContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CreateLivenessWithVerifySessionContent parameters = default; - Stream verifyImage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("Parameters"u8)) - { - parameters = CreateLivenessWithVerifySessionContent.DeserializeCreateLivenessWithVerifySessionContent(property.Value, options); - continue; - } - if (property.NameEquals("VerifyImage"u8)) - { - verifyImage = BinaryData.FromString(property.Value.GetRawText()).ToStream(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessWithVerifySessionMultipartContent(parameters, verifyImage, serializedAdditionalRawData); - } - - private BinaryData SerializeMultipart(ModelReaderWriterOptions options) - { - using MultipartFormDataRequestContent content = ToMultipartRequestContent(); - using MemoryStream stream = new MemoryStream(); - content.WriteTo(stream); - if (stream.Position > int.MaxValue) - { - return BinaryData.FromStream(stream); - } - else - { - return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position)); - } - } - - internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() - { - MultipartFormDataRequestContent content = new MultipartFormDataRequestContent(); - content.Add(ModelReaderWriter.Write(Parameters, ModelSerializationExtensions.WireOptions), "Parameters"); - content.Add(VerifyImage, "VerifyImage", "VerifyImage", "application/octet-stream"); - return content; - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - case "MFD": - return SerializeMultipart(options); - default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support writing '{options.Format}' format."); - } - } - - CreateLivenessWithVerifySessionMultipartContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateLivenessWithVerifySessionMultipartContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs deleted file mode 100644 index 972c14733528..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.IO; - -namespace Azure.AI.Vision.Face -{ - /// Request of liveness with verify session creation. - internal partial class CreateLivenessWithVerifySessionMultipartContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The parameters for creating session. - /// The image stream for verify. Content-Disposition header field for this part must have filename. - /// or is null. - public CreateLivenessWithVerifySessionMultipartContent(CreateLivenessWithVerifySessionContent parameters, Stream verifyImage) - { - Argument.AssertNotNull(parameters, nameof(parameters)); - Argument.AssertNotNull(verifyImage, nameof(verifyImage)); - - Parameters = parameters; - VerifyImage = verifyImage; - } - - /// Initializes a new instance of . - /// The parameters for creating session. - /// The image stream for verify. Content-Disposition header field for this part must have filename. - /// Keeps track of any properties unknown to the library. - internal CreateLivenessWithVerifySessionMultipartContent(CreateLivenessWithVerifySessionContent parameters, Stream verifyImage, IDictionary serializedAdditionalRawData) - { - Parameters = parameters; - VerifyImage = verifyImage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateLivenessWithVerifySessionMultipartContent() - { - } - - /// The parameters for creating session. - public CreateLivenessWithVerifySessionContent Parameters { get; } - /// The image stream for verify. Content-Disposition header field for this part must have filename. - public Stream VerifyImage { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs deleted file mode 100644 index b969512f54ce..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// Response of liveness session with verify creation with verify image provided. - public partial class CreateLivenessWithVerifySessionResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// or is null. - internal CreateLivenessWithVerifySessionResult(string sessionId, string authToken) - { - Argument.AssertNotNull(sessionId, nameof(sessionId)); - Argument.AssertNotNull(authToken, nameof(authToken)); - - SessionId = sessionId; - AuthToken = authToken; - } - - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// The detail of face for verification. - /// Keeps track of any properties unknown to the library. - internal CreateLivenessWithVerifySessionResult(string sessionId, string authToken, LivenessWithVerifyImage verifyImage, IDictionary serializedAdditionalRawData) - { - SessionId = sessionId; - AuthToken = authToken; - VerifyImage = verifyImage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateLivenessWithVerifySessionResult() - { - } - - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - public string SessionId { get; } - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - public string AuthToken { get; } - /// The detail of face for verification. - public LivenessWithVerifyImage VerifyImage { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml b/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml index 3754a0217479..8103910b8ae4 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml @@ -11,12 +11,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; -Response response = await client.CreateLivenessSessionAsync(body); +Response response = await client.CreateLivenessSessionAsync(body); ]]> @@ -29,12 +28,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; -Response response = client.CreateLivenessSession(body); +Response response = client.CreateLivenessSession(body); ]]> @@ -48,8 +46,7 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -58,6 +55,9 @@ Response response = await client.CreateLivenessSessionAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -71,8 +71,7 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -81,6 +80,9 @@ Response response = client.CreateLivenessSession(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -142,10 +144,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = await client.GetLivenessSessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -159,136 +162,85 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = client.GetLivenessSessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> - - -This sample shows how to call GetLivenessSessionsAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = await client.GetLivenessSessionsAsync(); -]]> - - - -This sample shows how to call GetLivenessSessions. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = client.GetLivenessSessions(); -]]> - - - -This sample shows how to call GetLivenessSessionsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = await client.GetLivenessSessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - - -This sample shows how to call GetLivenessSessions and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = client.GetLivenessSessions("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - + -This sample shows how to call GetLivenessSessionAuditEntriesAsync. +This sample shows how to call CreateLivenessWithVerifySessionAsync. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response> response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); +CreateLivenessWithVerifySessionContent body = null; +Response response = await client.CreateLivenessWithVerifySessionAsync(body); ]]> - + -This sample shows how to call GetLivenessSessionAuditEntries. +This sample shows how to call CreateLivenessWithVerifySession. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response> response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); +CreateLivenessWithVerifySessionContent body = null; +Response response = client.CreateLivenessWithVerifySession(body); ]]> - + -This sample shows how to call GetLivenessSessionAuditEntriesAsync and parse the result. +This sample shows how to call CreateLivenessWithVerifySessionAsync and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); +using RequestContent content = null; +Response response = await client.CreateLivenessWithVerifySessionAsync(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> - + -This sample shows how to call GetLivenessSessionAuditEntries and parse the result. +This sample shows how to call CreateLivenessWithVerifySession and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); +using RequestContent content = null; +Response response = client.CreateLivenessWithVerifySession(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -350,10 +302,17 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -367,136 +326,17 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = client.GetLivenessWithVerifySessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionsAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = await client.GetLivenessWithVerifySessionsAsync(); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessions. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = client.GetLivenessWithVerifySessions(); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = await client.GetLivenessWithVerifySessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessions and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = client.GetLivenessWithVerifySessions("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntriesAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntries. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntriesAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntries and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs index c3695cc5455d..2d54e4f2d175 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs @@ -108,14 +108,14 @@ public FaceSessionClient(Uri endpoint, TokenCredential credential, AzureAIVision /// is null. /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details. /// - public virtual async Task> CreateLivenessSessionAsync(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) + public virtual async Task> CreateLivenessSessionAsync(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response response = await CreateLivenessSessionAsync(content, context).ConfigureAwait(false); - return Response.FromValue(CreateLivenessSessionResult.FromResponse(response), response); + return Response.FromValue(LivenessSession.FromResponse(response), response); } /// Create a new detect liveness session. @@ -124,14 +124,14 @@ public virtual async Task> CreateLivenessS /// is null. /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details. /// - public virtual Response CreateLivenessSession(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) + public virtual Response CreateLivenessSession(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response response = CreateLivenessSession(content, context); - return Response.FromValue(CreateLivenessSessionResult.FromResponse(response), response); + return Response.FromValue(LivenessSession.FromResponse(response), response); } /// @@ -336,555 +336,15 @@ public virtual Response GetLivenessSessionResult(string session /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetLivenessSessionResultAsync(string sessionId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetLivenessSessionResult(string sessionId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists sessions for /detectLiveness/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details. - /// - public virtual async Task>> GetLivenessSessionsAsync(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessSessionsAsync(start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// Lists sessions for /detectLiveness/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details. - /// - public virtual Response> GetLivenessSessions(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessSessions(start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// - /// [Protocol Method] Lists sessions for /detectLiveness/SingleModal. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetLivenessSessionsAsync(string start, int? top, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessions"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionsRequest(start, top, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Lists sessions for /detectLiveness/SingleModal. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetLivenessSessions(string start, int? top, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessions"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionsRequest(start, top, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task>> GetLivenessSessionAuditEntriesAsync(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessSessionAuditEntriesAsync(sessionId, start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response> GetLivenessSessionAuditEntries(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessSessionAuditEntries(sessionId, start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetLivenessSessionAuditEntriesAsync(string sessionId, string start, int? top, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionAuditEntries"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionAuditEntriesRequest(sessionId, start, top, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetLivenessSessionAuditEntries(string sessionId, string start, int? top, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionAuditEntries"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionAuditEntriesRequest(sessionId, start, top, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// Body parameter. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details. - internal virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateLivenessWithVerifySessionAsync(content, context).ConfigureAwait(false); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// Body parameter. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details. - internal virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateLivenessWithVerifySession(content, context); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task CreateLivenessWithVerifySessionAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response CreateLivenessWithVerifySession(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a new liveness session with verify. Provide the verify image during session creation. - /// Request content of liveness with verify session creation. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. - internal virtual async Task> CreateLivenessWithVerifySessionWithVerifyImageAsync(CreateLivenessWithVerifySessionMultipartContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateLivenessWithVerifySessionWithVerifyImageAsync(content, content.ContentType, context).ConfigureAwait(false); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// Create a new liveness session with verify. Provide the verify image during session creation. - /// Request content of liveness with verify session creation. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. - internal virtual Response CreateLivenessWithVerifySessionWithVerifyImage(CreateLivenessWithVerifySessionMultipartContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateLivenessWithVerifySessionWithVerifyImage(content, content.ContentType, context); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task CreateLivenessWithVerifySessionWithVerifyImageAsync(RequestContent content, string contentType, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySessionWithVerifyImage"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(content, contentType, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response CreateLivenessWithVerifySessionWithVerifyImage(RequestContent content, string contentType, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySessionWithVerifyImage"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(content, contentType, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method - /// - /// [Protocol Method] Delete all session related information for matching the specified session id. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task DeleteLivenessWithVerifySessionAsync(string sessionId, RequestContext context = null) + public virtual async Task GetLivenessSessionResultAsync(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); scope.Start(); try { - using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); + using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -894,15 +354,19 @@ public virtual async Task DeleteLivenessWithVerifySessionAsync(string } } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Delete all session related information for matching the specified session id. + /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details. /// /// /// /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The unique ID to reference this session. @@ -911,16 +375,16 @@ public virtual async Task DeleteLivenessWithVerifySessionAsync(string /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DeleteLivenessWithVerifySession(string sessionId, RequestContext context = null) + /// + public virtual Response GetLivenessSessionResult(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); scope.Start(); try { - using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); + using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -930,38 +394,40 @@ public virtual Response DeleteLivenessWithVerifySession(string sessionId, Reques } } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. - /// The unique ID to reference this session. + /// Create a new liveness session with verify. Provide the verify image during session creation. + /// Request content of liveness with verify session creation. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task> GetLivenessWithVerifySessionResultAsync(string sessionId, CancellationToken cancellationToken = default) + /// is null. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. + /// + public virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(body, nameof(body)); + using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessWithVerifySessionResultAsync(sessionId, context).ConfigureAwait(false); + Response response = await CreateLivenessWithVerifySessionAsync(content, content.ContentType, context).ConfigureAwait(false); return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. - /// The unique ID to reference this session. + /// Create a new liveness session with verify. Provide the verify image during session creation. + /// Request content of liveness with verify session creation. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response GetLivenessWithVerifySessionResult(string sessionId, CancellationToken cancellationToken = default) + /// is null. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. + /// + public virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(body, nameof(body)); + using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessWithVerifySessionResult(sessionId, context); + Response response = CreateLivenessWithVerifySession(content, content.ContentType, context); return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. + /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. /// /// /// @@ -970,27 +436,27 @@ public virtual Response GetLivenessWithVerifySessionR /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The unique ID to reference this session. + /// The content to send as the body of the request. + /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetLivenessWithVerifySessionResultAsync(string sessionId, RequestContext context) + /// + public virtual async Task CreateLivenessWithVerifySessionAsync(RequestContent content, string contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); + using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, contentType, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1001,7 +467,7 @@ public virtual async Task GetLivenessWithVerifySessionResultAsync(stri } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. + /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. /// /// /// @@ -1010,27 +476,27 @@ public virtual async Task GetLivenessWithVerifySessionResultAsync(stri /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The unique ID to reference this session. + /// The content to send as the body of the request. + /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetLivenessWithVerifySessionResult(string sessionId, RequestContext context) + /// + public virtual Response CreateLivenessWithVerifySession(RequestContent content, string contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); + using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, contentType, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1040,76 +506,33 @@ public virtual Response GetLivenessWithVerifySessionResult(string sessionId, Req } } - /// Lists sessions for /detectLivenessWithVerify/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details. - /// - public virtual async Task>> GetLivenessWithVerifySessionsAsync(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessWithVerifySessionsAsync(start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// Lists sessions for /detectLivenessWithVerify/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details. - /// - public virtual Response> GetLivenessWithVerifySessions(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessWithVerifySessions(start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Lists sessions for /detectLivenessWithVerify/SingleModal. + /// [Protocol Method] Delete all session related information for matching the specified session id. /// /// /// /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// /// /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. + /// The unique ID to reference this session. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetLivenessWithVerifySessionsAsync(string start, int? top, RequestContext context) + /// + public virtual async Task DeleteLivenessWithVerifySessionAsync(string sessionId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions"); + Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(start, top, context); + using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1119,34 +542,33 @@ public virtual async Task GetLivenessWithVerifySessionsAsync(string st } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Lists sessions for /detectLivenessWithVerify/SingleModal. + /// [Protocol Method] Delete all session related information for matching the specified session id. /// /// /// /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// /// /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. + /// The unique ID to reference this session. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetLivenessWithVerifySessions(string start, int? top, RequestContext context) + /// + public virtual Response DeleteLivenessWithVerifySession(string sessionId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions"); + Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(start, top, context); + using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1156,58 +578,38 @@ public virtual Response GetLivenessWithVerifySessions(string start, int? top, Re } } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task>> GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) + /// + public virtual async Task> GetLivenessWithVerifySessionResultAsync(string sessionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessWithVerifySessionAuditEntriesAsync(sessionId, start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); + Response response = await GetLivenessWithVerifySessionResultAsync(sessionId, context).ConfigureAwait(false); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual Response> GetLivenessWithVerifySessionAuditEntries(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) + /// + public virtual Response GetLivenessWithVerifySessionResult(string sessionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessWithVerifySessionAuditEntries(sessionId, start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); + Response response = GetLivenessWithVerifySessionResult(sessionId, context); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// /// /// @@ -1216,29 +618,27 @@ public virtual Response> GetLivenessWit /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start, int? top, RequestContext context) + /// + public virtual async Task GetLivenessWithVerifySessionResultAsync(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(sessionId, start, top, context); + using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1249,7 +649,7 @@ public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsyn } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// /// /// @@ -1258,29 +658,27 @@ public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsyn /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetLivenessWithVerifySessionAuditEntries(string sessionId, string start, int? top, RequestContext context) + /// + public virtual Response GetLivenessWithVerifySessionResult(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(sessionId, start, top, context); + using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1563,7 +961,7 @@ internal HttpMessage CreateCreateLivenessSessionRequest(RequestContent content, uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions", false); + uri.AppendPath("/detectLiveness-sessions", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1573,14 +971,14 @@ internal HttpMessage CreateCreateLivenessSessionRequest(RequestContent content, internal HttpMessage CreateDeleteLivenessSessionRequest(string sessionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions/", false); + uri.AppendPath("/detectLiveness-sessions/", false); uri.AppendPath(sessionId, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1596,79 +994,14 @@ internal HttpMessage CreateGetLivenessSessionResultRequest(string sessionId, Req uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions/", false); - uri.AppendPath(sessionId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessSessionsRequest(string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessSessionAuditEntriesRequest(string sessionId, string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions/", false); + uri.AppendPath("/detectLiveness-sessions/", false); uri.AppendPath(sessionId, true); - uri.AppendPath("/audit", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCreateLivenessWithVerifySessionRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; return message; } - internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(RequestContent content, string contentType, RequestContext context) + internal HttpMessage CreateCreateLivenessWithVerifySessionRequest(RequestContent content, string contentType, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1677,7 +1010,7 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); + uri.AppendPath("/detectLivenessWithVerify-sessions", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", contentType); @@ -1687,14 +1020,14 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest internal HttpMessage CreateDeleteLivenessWithVerifySessionRequest(string sessionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); + uri.AppendPath("/detectLivenessWithVerify-sessions/", false); uri.AppendPath(sessionId, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1710,56 +1043,8 @@ internal HttpMessage CreateGetLivenessWithVerifySessionResultRequest(string sess uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); - uri.AppendPath(sessionId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessWithVerifySessionsRequest(string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessWithVerifySessionAuditEntriesRequest(string sessionId, string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); + uri.AppendPath("/detectLivenessWithVerify-sessions/", false); uri.AppendPath(sessionId, true); - uri.AppendPath("/audit", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1819,7 +1104,7 @@ internal HttpMessage CreateGetSessionImageRequest(string sessionImageId, Request uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/session/sessionImages/", false); + uri.AppendPath("/sessionImages/", false); uri.AppendPath(sessionImageId, true); request.Uri = uri; request.Headers.Add("Accept", "application/octet-stream"); @@ -1839,5 +1124,7 @@ internal static RequestContext FromCancellationToken(CancellationToken cancellat private static ResponseClassifier _responseClassifier200; private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs deleted file mode 100644 index 6c583b333353..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Vision.Face -{ - /// The current status of the session. - public readonly partial struct FaceSessionStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public FaceSessionStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NotStartedValue = "NotStarted"; - private const string StartedValue = "Started"; - private const string ResultAvailableValue = "ResultAvailable"; - - /// Session has not started. - public static FaceSessionStatus NotStarted { get; } = new FaceSessionStatus(NotStartedValue); - /// Session has started. - public static FaceSessionStatus Started { get; } = new FaceSessionStatus(StartedValue); - /// Session has available result. - public static FaceSessionStatus ResultAvailable { get; } = new FaceSessionStatus(ResultAvailableValue); - /// Determines if two values are the same. - public static bool operator ==(FaceSessionStatus left, FaceSessionStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(FaceSessionStatus left, FaceSessionStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator FaceSessionStatus(string value) => new FaceSessionStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is FaceSessionStatus other && Equals(other); - /// - public bool Equals(FaceSessionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs index 77835b1ee957..df88bc879d6b 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs @@ -49,7 +49,7 @@ protected LargeFaceListClient() /// https://{resource-name}.cognitiveservices.azure.com). /// /// Valid character is letter in lower case or digit or '-' or '_', maximum length is 64. - /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1". + /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1" | "v1.2". internal LargeFaceListClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, TokenCredential tokenCredential, Uri endpoint, string largeFaceListId, string apiVersion) { ClientDiagnostics = clientDiagnostics; diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs index 4977323e0232..428215d0776f 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs @@ -49,7 +49,7 @@ protected LargePersonGroupClient() /// https://{resource-name}.cognitiveservices.azure.com). /// /// ID of the container. - /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1". + /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1" | "v1.2". internal LargePersonGroupClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, TokenCredential tokenCredential, Uri endpoint, string largePersonGroupId, string apiVersion) { ClientDiagnostics = clientDiagnostics; diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs similarity index 65% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs index 15b072f6e4b7..f7ba4a27e38d 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class CreateLivenessSessionResult : IUtf8JsonSerializable, IJsonModel + public partial class LivenessColorDecisionTarget : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{format}' format."); } - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("authToken"u8); - writer.WriteStringValue(AuthToken); + writer.WritePropertyName("faceRectangle"u8); + writer.WriteObjectValue(FaceRectangle, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -55,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CreateLivenessSessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessColorDecisionTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessSessionResult(document.RootElement, options); + return DeserializeLivenessColorDecisionTarget(document.RootElement, options); } - internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessColorDecisionTarget DeserializeLivenessColorDecisionTarget(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -75,20 +73,14 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu { return null; } - string sessionId = default; - string authToken = default; + FaceRectangle faceRectangle = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sessionId"u8)) + if (property.NameEquals("faceRectangle"u8)) { - sessionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("authToken"u8)) - { - authToken = property.Value.GetString(); + faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); continue; } if (options.Format != "W") @@ -97,46 +89,46 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu } } serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessSessionResult(sessionId, authToken, serializedAdditionalRawData); + return new LivenessColorDecisionTarget(faceRectangle, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{options.Format}' format."); } } - CreateLivenessSessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessColorDecisionTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessSessionResult(document.RootElement, options); + return DeserializeLivenessColorDecisionTarget(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static CreateLivenessSessionResult FromResponse(Response response) + internal static LivenessColorDecisionTarget FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessSessionResult(document.RootElement); + return DeserializeLivenessColorDecisionTarget(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs similarity index 51% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs index 4469cf9f8d50..9a04763a6e3d 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs @@ -10,8 +10,8 @@ namespace Azure.AI.Vision.Face { - /// The liveness classification for target face. - public partial class LivenessOutputsTarget + /// The target from color image used for liveness classification. + public partial class LivenessColorDecisionTarget { /// /// Keeps track of any properties unknown to the library. @@ -45,50 +45,31 @@ public partial class LivenessOutputsTarget /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The face region where the liveness classification was made on. - /// The file name which contains the face rectangle where the liveness classification was made on. - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - /// The image type which contains the face rectangle where the liveness classification was made on. - /// or is null. - internal LivenessOutputsTarget(FaceRectangle faceRectangle, string fileName, int timeOffsetWithinFile, FaceImageType imageType) + /// is null. + internal LivenessColorDecisionTarget(FaceRectangle faceRectangle) { Argument.AssertNotNull(faceRectangle, nameof(faceRectangle)); - Argument.AssertNotNull(fileName, nameof(fileName)); FaceRectangle = faceRectangle; - FileName = fileName; - TimeOffsetWithinFile = timeOffsetWithinFile; - ImageType = imageType; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The face region where the liveness classification was made on. - /// The file name which contains the face rectangle where the liveness classification was made on. - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - /// The image type which contains the face rectangle where the liveness classification was made on. /// Keeps track of any properties unknown to the library. - internal LivenessOutputsTarget(FaceRectangle faceRectangle, string fileName, int timeOffsetWithinFile, FaceImageType imageType, IDictionary serializedAdditionalRawData) + internal LivenessColorDecisionTarget(FaceRectangle faceRectangle, IDictionary serializedAdditionalRawData) { FaceRectangle = faceRectangle; - FileName = fileName; - TimeOffsetWithinFile = timeOffsetWithinFile; - ImageType = imageType; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal LivenessOutputsTarget() + /// Initializes a new instance of for deserialization. + internal LivenessColorDecisionTarget() { } /// The face region where the liveness classification was made on. public FaceRectangle FaceRectangle { get; } - /// The file name which contains the face rectangle where the liveness classification was made on. - public string FileName { get; } - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - public int TimeOffsetWithinFile { get; } - /// The image type which contains the face rectangle where the liveness classification was made on. - public FaceImageType ImageType { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs new file mode 100644 index 000000000000..20ea28c7a099 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Vision.Face +{ + public partial class LivenessDecisionTargets : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("color"u8); + writer.WriteObjectValue(Color, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessDecisionTargets IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessDecisionTargets(document.RootElement, options); + } + + internal static LivenessDecisionTargets DeserializeLivenessDecisionTargets(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LivenessColorDecisionTarget color = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("color"u8)) + { + color = LivenessColorDecisionTarget.DeserializeLivenessColorDecisionTarget(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessDecisionTargets(color, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support writing '{options.Format}' format."); + } + } + + LivenessDecisionTargets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessDecisionTargets(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessDecisionTargets FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessDecisionTargets(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs new file mode 100644 index 000000000000..8e64b0560f73 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The targets used for liveness classification. + public partial class LivenessDecisionTargets + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The target from color image used for liveness classification. + /// is null. + internal LivenessDecisionTargets(LivenessColorDecisionTarget color) + { + Argument.AssertNotNull(color, nameof(color)); + + Color = color; + } + + /// Initializes a new instance of . + /// The target from color image used for liveness classification. + /// Keeps track of any properties unknown to the library. + internal LivenessDecisionTargets(LivenessColorDecisionTarget color, IDictionary serializedAdditionalRawData) + { + Color = color; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessDecisionTargets() + { + } + + /// The target from color image used for liveness classification. + public LivenessColorDecisionTarget Color { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs similarity index 57% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs index 3d4f997e8429..617f0c01c590 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class AuditLivenessResponseInfo : IUtf8JsonSerializable, IJsonModel + public partial class LivenessError : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,18 +28,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{format}' format."); } - writer.WritePropertyName("body"u8); - writer.WriteObjectValue(Body, options); - writer.WritePropertyName("statusCode"u8); - writer.WriteNumberValue(StatusCode); - writer.WritePropertyName("latencyInMilliseconds"u8); - writer.WriteNumberValue(LatencyInMilliseconds); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -57,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AuditLivenessResponseInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAuditLivenessResponseInfo(document.RootElement, options); + return DeserializeLivenessError(document.RootElement, options); } - internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessError DeserializeLivenessError(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -77,26 +77,26 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J { return null; } - LivenessResponseBody body = default; - int statusCode = default; - long latencyInMilliseconds = default; + string code = default; + string message = default; + LivenessDecisionTargets targets = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("body"u8)) + if (property.NameEquals("code"u8)) { - body = LivenessResponseBody.DeserializeLivenessResponseBody(property.Value, options); + code = property.Value.GetString(); continue; } - if (property.NameEquals("statusCode"u8)) + if (property.NameEquals("message"u8)) { - statusCode = property.Value.GetInt32(); + message = property.Value.GetString(); continue; } - if (property.NameEquals("latencyInMilliseconds"u8)) + if (property.NameEquals("targets"u8)) { - latencyInMilliseconds = property.Value.GetInt64(); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } if (options.Format != "W") @@ -105,46 +105,46 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J } } serializedAdditionalRawData = rawDataDictionary; - return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData); + return new LivenessError(code, message, targets, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{options.Format}' format."); } } - AuditLivenessResponseInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditLivenessResponseInfo(document.RootElement, options); + return DeserializeLivenessError(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static AuditLivenessResponseInfo FromResponse(Response response) + internal static LivenessError FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditLivenessResponseInfo(document.RootElement); + return DeserializeLivenessError(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs new file mode 100644 index 000000000000..4b38aa3b7260 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The error of the liveness classification. + public partial class LivenessError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// Targets used for liveness classification. + /// , or is null. + internal LivenessError(string code, string message, LivenessDecisionTargets targets) + { + Argument.AssertNotNull(code, nameof(code)); + Argument.AssertNotNull(message, nameof(message)); + Argument.AssertNotNull(targets, nameof(targets)); + + Code = code; + Message = message; + Targets = targets; + } + + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// Targets used for liveness classification. + /// Keeps track of any properties unknown to the library. + internal LivenessError(string code, string message, LivenessDecisionTargets targets, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + Targets = targets; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessError() + { + } + + /// The error code. + public string Code { get; } + /// The error message. + public string Message { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs index f5a0af9fc967..8cf63b931713 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs @@ -22,13 +22,10 @@ public LivenessModel(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string V20221015Preview04Value = "2022-10-15-preview.04"; - private const string V20231220Preview06Value = "2023-12-20-preview.06"; + private const string V20241115Value = "2024-11-15"; - /// 2022-10-15-preview.04. - public static LivenessModel V20221015Preview04 { get; } = new LivenessModel(V20221015Preview04Value); - /// 2023-12-20-preview.06. - public static LivenessModel V20231220Preview06 { get; } = new LivenessModel(V20231220Preview06Value); + /// 2024-11-15. + public static LivenessModel V20241115 { get; } = new LivenessModel(V20241115Value); /// Determines if two values are the same. public static bool operator ==(LivenessModel left, LivenessModel right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs deleted file mode 100644 index 02ee779e066f..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Vision.Face -{ - public partial class LivenessResponseBody : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(LivenessResponseBody)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(LivenessDecision)) - { - writer.WritePropertyName("livenessDecision"u8); - writer.WriteStringValue(LivenessDecision.Value.ToString()); - } - if (Optional.IsDefined(Target)) - { - writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target, options); - } - if (Optional.IsDefined(ModelVersionUsed)) - { - writer.WritePropertyName("modelVersionUsed"u8); - writer.WriteStringValue(ModelVersionUsed.Value.ToString()); - } - if (Optional.IsDefined(VerifyResult)) - { - writer.WritePropertyName("verifyResult"u8); - writer.WriteObjectValue(VerifyResult, options); - } - foreach (var item in AdditionalProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - - LivenessResponseBody IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(LivenessResponseBody)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessResponseBody(document.RootElement, options); - } - - internal static LivenessResponseBody DeserializeLivenessResponseBody(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - FaceLivenessDecision? livenessDecision = default; - LivenessOutputsTarget target = default; - LivenessModel? modelVersionUsed = default; - LivenessWithVerifyOutputs verifyResult = default; - IReadOnlyDictionary additionalProperties = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("livenessDecision"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - livenessDecision = new FaceLivenessDecision(property.Value.GetString()); - continue; - } - if (property.NameEquals("target"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - target = LivenessOutputsTarget.DeserializeLivenessOutputsTarget(property.Value, options); - continue; - } - if (property.NameEquals("modelVersionUsed"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - modelVersionUsed = new LivenessModel(property.Value.GetString()); - continue; - } - if (property.NameEquals("verifyResult"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - verifyResult = LivenessWithVerifyOutputs.DeserializeLivenessWithVerifyOutputs(property.Value, options); - continue; - } - additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - additionalProperties = additionalPropertiesDictionary; - return new LivenessResponseBody(livenessDecision, target, modelVersionUsed, verifyResult, additionalProperties); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(LivenessResponseBody)} does not support writing '{options.Format}' format."); - } - } - - LivenessResponseBody IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessResponseBody(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LivenessResponseBody)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static LivenessResponseBody FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessResponseBody(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs deleted file mode 100644 index 5d831412b0a9..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// The response body of detect liveness API call. - public partial class LivenessResponseBody - { - /// Initializes a new instance of . - internal LivenessResponseBody() - { - AdditionalProperties = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The liveness classification for the target face. - /// Specific targets used for liveness classification. - /// The model version used for liveness classification. - /// The face verification output. Only available when the request is liveness with verify. - /// Additional Properties. - internal LivenessResponseBody(FaceLivenessDecision? livenessDecision, LivenessOutputsTarget target, LivenessModel? modelVersionUsed, LivenessWithVerifyOutputs verifyResult, IReadOnlyDictionary additionalProperties) - { - LivenessDecision = livenessDecision; - Target = target; - ModelVersionUsed = modelVersionUsed; - VerifyResult = verifyResult; - AdditionalProperties = additionalProperties; - } - - /// The liveness classification for the target face. - public FaceLivenessDecision? LivenessDecision { get; } - /// Specific targets used for liveness classification. - public LivenessOutputsTarget Target { get; } - /// The model version used for liveness classification. - public LivenessModel? ModelVersionUsed { get; } - /// The face verification output. Only available when the request is liveness with verify. - public LivenessWithVerifyOutputs VerifyResult { get; } - /// - /// Additional Properties - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public IReadOnlyDictionary AdditionalProperties { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs index 4fb71cbac633..6a386a5fd74b 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class CreateLivenessWithVerifySessionResult : IUtf8JsonSerializable, IJsonModel + public partial class LivenessResult : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,20 +28,25 @@ void IJsonModel.Write(Utf8JsonWriter writ /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("authToken"u8); - writer.WriteStringValue(AuthToken); - if (Optional.IsDefined(VerifyImage)) + if (Optional.IsDefined(LivenessDecision)) { - writer.WritePropertyName("verifyImage"u8); - writer.WriteObjectValue(VerifyImage, options); + writer.WritePropertyName("livenessDecision"u8); + writer.WriteStringValue(LivenessDecision.Value.ToString()); + } + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); + writer.WritePropertyName("digest"u8); + writer.WriteStringValue(Digest); + if (Optional.IsDefined(SessionImageId)) + { + writer.WritePropertyName("sessionImageId"u8); + writer.WriteStringValue(SessionImageId); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -60,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CreateLivenessWithVerifySessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } - internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessWithVerifySessionResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessResult DeserializeLivenessResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -80,30 +85,36 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW { return null; } - string sessionId = default; - string authToken = default; - LivenessWithVerifyImage verifyImage = default; + FaceLivenessDecision? livenessDecision = default; + LivenessDecisionTargets targets = default; + string digest = default; + string sessionImageId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sessionId"u8)) + if (property.NameEquals("livenessDecision"u8)) { - sessionId = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + livenessDecision = new FaceLivenessDecision(property.Value.GetString()); continue; } - if (property.NameEquals("authToken"u8)) + if (property.NameEquals("targets"u8)) { - authToken = property.Value.GetString(); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } - if (property.NameEquals("verifyImage"u8)) + if (property.NameEquals("digest"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - verifyImage = LivenessWithVerifyImage.DeserializeLivenessWithVerifyImage(property.Value, options); + digest = property.Value.GetString(); + continue; + } + if (property.NameEquals("sessionImageId"u8)) + { + sessionImageId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -112,46 +123,46 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW } } serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessWithVerifySessionResult(sessionId, authToken, verifyImage, serializedAdditionalRawData); + return new LivenessResult(livenessDecision, targets, digest, sessionImageId, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support writing '{options.Format}' format."); } } - CreateLivenessWithVerifySessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static CreateLivenessWithVerifySessionResult FromResponse(Response response) + internal static LivenessResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement); + return DeserializeLivenessResult(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs new file mode 100644 index 000000000000..cf20e1fdeca9 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness classification. + public partial class LivenessResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// or is null. + internal LivenessResult(LivenessDecisionTargets targets, string digest) + { + Argument.AssertNotNull(targets, nameof(targets)); + Argument.AssertNotNull(digest, nameof(digest)); + + Targets = targets; + Digest = digest; + } + + /// Initializes a new instance of . + /// The liveness classification for the target face. + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// Keeps track of any properties unknown to the library. + internal LivenessResult(FaceLivenessDecision? livenessDecision, LivenessDecisionTargets targets, string digest, string sessionImageId, IDictionary serializedAdditionalRawData) + { + LivenessDecision = livenessDecision; + Targets = targets; + Digest = digest; + SessionImageId = sessionImageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessResult() + { + } + + /// The liveness classification for the target face. + public FaceLivenessDecision? LivenessDecision { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + public string Digest { get; } + /// The image ID of the session request. + public string SessionImageId { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs index 64b251d3ced0..0513d2d422a9 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs @@ -36,35 +36,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W") { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) - { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId); } + writer.WritePropertyName("authToken"u8); + writer.WriteStringValue(AuthToken); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); - if (Optional.IsDefined(Result)) + if (Optional.IsDefined(ModelVersion)) { - writer.WritePropertyName("result"u8); - writer.WriteObjectValue(Result, options); + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion.Value.ToString()); } + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +87,42 @@ internal static LivenessSession DeserializeLivenessSession(JsonElement element, { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; - FaceSessionStatus status = default; - LivenessSessionAuditEntry result = default; + string sessionId = default; + string authToken = default; + OperationState status = default; + LivenessModel? modelVersion = default; + LivenessSessionResults results = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("sessionId"u8)) { - id = property.Value.GetString(); + sessionId = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("authToken"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionStartDateTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) + if (property.NameEquals("status"u8)) { - deviceCorrelationId = property.Value.GetString(); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new FaceSessionStatus(property.Value.GetString()); + modelVersion = new LivenessModel(property.Value.GetString()); continue; } - if (property.NameEquals("result"u8)) + if (property.NameEquals("results"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - result = LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(property.Value, options); + results = LivenessSessionResults.DeserializeLivenessSessionResults(property.Value, options); continue; } if (options.Format != "W") @@ -173,14 +132,11 @@ internal static LivenessSession DeserializeLivenessSession(JsonElement element, } serializedAdditionalRawData = rawDataDictionary; return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, serializedAdditionalRawData); } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs index bda0898e67ff..7a073ee5cd14 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs @@ -46,36 +46,34 @@ public partial class LivenessSession private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// DateTime when this session was created. - /// Whether or not the session is expired. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - internal LivenessSession(DateTimeOffset createdDateTime, bool sessionExpired, FaceSessionStatus status) + /// The results of the liveness session. + /// or is null. + internal LivenessSession(string authToken, OperationState status, LivenessSessionResults results) { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; + Argument.AssertNotNull(authToken, nameof(authToken)); + Argument.AssertNotNull(results, nameof(results)); + + AuthToken = authToken; Status = status; + Results = results; } /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness session. /// Keeps track of any properties unknown to the library. - internal LivenessSession(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, FaceSessionStatus status, LivenessSessionAuditEntry result, IDictionary serializedAdditionalRawData) + internal LivenessSession(string sessionId, string authToken, OperationState status, LivenessModel? modelVersion, LivenessSessionResults results, IDictionary serializedAdditionalRawData) { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + SessionId = sessionId; + AuthToken = authToken; Status = status; - Result = result; + ModelVersion = modelVersion; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +83,14 @@ internal LivenessSession() } /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { get; } - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - public string DeviceCorrelationId { get; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } + public string SessionId { get; } + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. + public string AuthToken { get; } /// The current status of the session. - public FaceSessionStatus Status { get; } - /// The latest session audit result only populated if status == 'ResultAvailable'. - public LivenessSessionAuditEntry Result { get; } + public OperationState Status { get; } + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + public LivenessModel? ModelVersion { get; } + /// The results of the liveness session. + public LivenessSessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs new file mode 100644 index 000000000000..35f22ed2bb12 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Vision.Face +{ + public partial class LivenessSessionAttempt : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessSessionAttempt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessSessionAttempt(document.RootElement, options); + } + + internal static LivenessSessionAttempt DeserializeLivenessSessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int attemptId = default; + OperationState attemptStatus = default; + LivenessResult result = default; + LivenessError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attemptId"u8)) + { + attemptId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("attemptStatus"u8)) + { + attemptStatus = new OperationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = LivenessResult.DeserializeLivenessResult(property.Value, options); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = LivenessError.DeserializeLivenessError(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessSessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} does not support writing '{options.Format}' format."); + } + } + + LivenessSessionAttempt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionAttempt(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessSessionAttempt FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionAttempt(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs new file mode 100644 index 000000000000..0f414f5127d8 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The liveness session attempt. + public partial class LivenessSessionAttempt + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + internal LivenessSessionAttempt(int attemptId, OperationState attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + } + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness call, will be null if there is error. + /// The error of the liveness call, will be null if there is result. + /// Keeps track of any properties unknown to the library. + internal LivenessSessionAttempt(int attemptId, OperationState attemptStatus, LivenessResult result, LivenessError error, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessSessionAttempt() + { + } + + /// The attempt ID, start from 1. + public int AttemptId { get; } + /// The status of the attempt. + public OperationState AttemptStatus { get; } + /// The result of the liveness call, will be null if there is error. + public LivenessResult Result { get; } + /// The error of the liveness call, will be null if there is result. + public LivenessError Error { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs deleted file mode 100644 index 46b364a13ffd..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// Audit entry for a request in session. - public partial class LivenessSessionAuditEntry - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - /// The UTC DateTime that the request was received. - /// The request of this entry. - /// The response of this entry. - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - /// , , , , or is null. - internal LivenessSessionAuditEntry(long id, string sessionId, string requestId, string clientRequestId, DateTimeOffset receivedDateTime, AuditRequestInfo request, AuditLivenessResponseInfo response, string digest) - { - Argument.AssertNotNull(sessionId, nameof(sessionId)); - Argument.AssertNotNull(requestId, nameof(requestId)); - Argument.AssertNotNull(clientRequestId, nameof(clientRequestId)); - Argument.AssertNotNull(request, nameof(request)); - Argument.AssertNotNull(response, nameof(response)); - Argument.AssertNotNull(digest, nameof(digest)); - - Id = id; - SessionId = sessionId; - RequestId = requestId; - ClientRequestId = clientRequestId; - ReceivedDateTime = receivedDateTime; - Request = request; - Response = response; - Digest = digest; - } - - /// Initializes a new instance of . - /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - /// The UTC DateTime that the request was received. - /// The request of this entry. - /// The response of this entry. - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - /// The image ID of the session request. - /// The sha256 hash of the verify-image in the request. - /// Keeps track of any properties unknown to the library. - internal LivenessSessionAuditEntry(long id, string sessionId, string requestId, string clientRequestId, DateTimeOffset receivedDateTime, AuditRequestInfo request, AuditLivenessResponseInfo response, string digest, string sessionImageId, string verifyImageHash, IDictionary serializedAdditionalRawData) - { - Id = id; - SessionId = sessionId; - RequestId = requestId; - ClientRequestId = clientRequestId; - ReceivedDateTime = receivedDateTime; - Request = request; - Response = response; - Digest = digest; - SessionImageId = sessionImageId; - VerifyImageHash = verifyImageHash; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal LivenessSessionAuditEntry() - { - } - - /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - public long Id { get; } - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - public string SessionId { get; } - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - public string RequestId { get; } - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - public string ClientRequestId { get; } - /// The UTC DateTime that the request was received. - public DateTimeOffset ReceivedDateTime { get; } - /// The request of this entry. - public AuditRequestInfo Request { get; } - /// The response of this entry. - public AuditLivenessResponseInfo Response { get; } - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - public string Digest { get; } - /// The image ID of the session request. - public string SessionImageId { get; } - /// The sha256 hash of the verify-image in the request. - public string VerifyImageHash { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs deleted file mode 100644 index e46e4901a8a1..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// Session data returned for enumeration. - public partial class LivenessSessionItem - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// DateTime when this session was created. - /// Whether or not the session is expired. - internal LivenessSessionItem(DateTimeOffset createdDateTime, bool sessionExpired) - { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; - } - - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - /// Keeps track of any properties unknown to the library. - internal LivenessSessionItem(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) - { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal LivenessSessionItem() - { - } - - /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { get; } - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - public string DeviceCorrelationId { get; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs new file mode 100644 index 000000000000..75f8162577e8 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Vision.Face +{ + public partial class LivenessSessionResults : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessSessionResults)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attempts"u8); + writer.WriteStartArray(); + foreach (var item in Attempts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessSessionResults IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessSessionResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessSessionResults(document.RootElement, options); + } + + internal static LivenessSessionResults DeserializeLivenessSessionResults(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList attempts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attempts"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessSessionAttempt.DeserializeLivenessSessionAttempt(item, options)); + } + attempts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessSessionResults(attempts, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LivenessSessionResults)} does not support writing '{options.Format}' format."); + } + } + + LivenessSessionResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessSessionResults)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessSessionResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionResults(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs new file mode 100644 index 000000000000..1a3686a45577 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness session. + public partial class LivenessSessionResults + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The attempts data of underlying liveness call with the session. + /// is null. + internal LivenessSessionResults(IEnumerable attempts) + { + Argument.AssertNotNull(attempts, nameof(attempts)); + + Attempts = attempts.ToList(); + } + + /// Initializes a new instance of . + /// The attempts data of underlying liveness call with the session. + /// Keeps track of any properties unknown to the library. + internal LivenessSessionResults(IReadOnlyList attempts, IDictionary serializedAdditionalRawData) + { + Attempts = attempts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessSessionResults() + { + } + + /// The attempts data of underlying liveness call with the session. + public IReadOnlyList Attempts { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs index f82efb60a43d..79f11aaffbd3 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs @@ -34,8 +34,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(LivenessWithVerifyOutputs)} does not support writing '{format}' format."); } - writer.WritePropertyName("verifyImage"u8); - writer.WriteObjectValue(VerifyImage, options); writer.WritePropertyName("matchConfidence"u8); writer.WriteNumberValue(MatchConfidence); writer.WritePropertyName("isIdentical"u8); @@ -77,18 +75,12 @@ internal static LivenessWithVerifyOutputs DeserializeLivenessWithVerifyOutputs(J { return null; } - LivenessWithVerifyImage verifyImage = default; float matchConfidence = default; bool isIdentical = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("verifyImage"u8)) - { - verifyImage = LivenessWithVerifyImage.DeserializeLivenessWithVerifyImage(property.Value, options); - continue; - } if (property.NameEquals("matchConfidence"u8)) { matchConfidence = property.Value.GetSingle(); @@ -105,7 +97,7 @@ internal static LivenessWithVerifyOutputs DeserializeLivenessWithVerifyOutputs(J } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessWithVerifyOutputs(verifyImage, matchConfidence, isIdentical, serializedAdditionalRawData); + return new LivenessWithVerifyOutputs(matchConfidence, isIdentical, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs index 45c6d6405b7f..3abf91ab403f 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs @@ -46,27 +46,20 @@ public partial class LivenessWithVerifyOutputs private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// The detail of face for verification. /// The target face liveness face and comparison image face verification confidence. /// Whether the target liveness face and comparison image face match. - /// is null. - internal LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage, float matchConfidence, bool isIdentical) + internal LivenessWithVerifyOutputs(float matchConfidence, bool isIdentical) { - Argument.AssertNotNull(verifyImage, nameof(verifyImage)); - - VerifyImage = verifyImage; MatchConfidence = matchConfidence; IsIdentical = isIdentical; } /// Initializes a new instance of . - /// The detail of face for verification. /// The target face liveness face and comparison image face verification confidence. /// Whether the target liveness face and comparison image face match. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage, float matchConfidence, bool isIdentical, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifyOutputs(float matchConfidence, bool isIdentical, IDictionary serializedAdditionalRawData) { - VerifyImage = verifyImage; MatchConfidence = matchConfidence; IsIdentical = isIdentical; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -77,8 +70,6 @@ internal LivenessWithVerifyOutputs() { } - /// The detail of face for verification. - public LivenessWithVerifyImage VerifyImage { get; } /// The target face liveness face and comparison image face verification confidence. public float MatchConfidence { get; } /// Whether the target liveness face and comparison image face match. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs similarity index 65% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs index fa30773e4bc8..dcf2014c1505 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessWithVerifyImage : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifyReference : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,12 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessWithVerifyImage)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support writing '{format}' format."); } + writer.WritePropertyName("referenceType"u8); + writer.WriteStringValue(ReferenceType.ToString()); writer.WritePropertyName("faceRectangle"u8); writer.WriteObjectValue(FaceRectangle, options); writer.WritePropertyName("qualityForRecognition"u8); @@ -55,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessWithVerifyImage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifyReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessWithVerifyImage)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessWithVerifyImage(document.RootElement, options); + return DeserializeLivenessWithVerifyReference(document.RootElement, options); } - internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifyReference DeserializeLivenessWithVerifyReference(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -75,12 +77,18 @@ internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonE { return null; } + FaceImageType referenceType = default; FaceRectangle faceRectangle = default; QualityForRecognition qualityForRecognition = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("referenceType"u8)) + { + referenceType = new FaceImageType(property.Value.GetString()); + continue; + } if (property.NameEquals("faceRectangle"u8)) { faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); @@ -97,46 +105,46 @@ internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessWithVerifyImage(faceRectangle, qualityForRecognition, serializedAdditionalRawData); + return new LivenessWithVerifyReference(referenceType, faceRectangle, qualityForRecognition, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(LivenessWithVerifyImage)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support writing '{options.Format}' format."); } } - LivenessWithVerifyImage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifyReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessWithVerifyImage(document.RootElement, options); + return DeserializeLivenessWithVerifyReference(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessWithVerifyImage)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessWithVerifyImage FromResponse(Response response) + internal static LivenessWithVerifyReference FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessWithVerifyImage(document.RootElement); + return DeserializeLivenessWithVerifyReference(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs similarity index 73% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs index 2cb09a6725ef..fe5f68bc902c 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Vision.Face { /// The detail of face for verification. - public partial class LivenessWithVerifyImage + public partial class LivenessWithVerifyReference { /// /// Keeps track of any properties unknown to the library. @@ -45,34 +45,40 @@ public partial class LivenessWithVerifyImage /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The image type which contains the face rectangle where the liveness classification was made on. /// The face region where the comparison image's classification was made. /// Quality of face image for recognition. /// is null. - internal LivenessWithVerifyImage(FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition) + internal LivenessWithVerifyReference(FaceImageType referenceType, FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition) { Argument.AssertNotNull(faceRectangle, nameof(faceRectangle)); + ReferenceType = referenceType; FaceRectangle = faceRectangle; QualityForRecognition = qualityForRecognition; } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The image type which contains the face rectangle where the liveness classification was made on. /// The face region where the comparison image's classification was made. /// Quality of face image for recognition. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifyImage(FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifyReference(FaceImageType referenceType, FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition, IDictionary serializedAdditionalRawData) { + ReferenceType = referenceType; FaceRectangle = faceRectangle; QualityForRecognition = qualityForRecognition; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal LivenessWithVerifyImage() + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifyReference() { } + /// The image type which contains the face rectangle where the liveness classification was made on. + public FaceImageType ReferenceType { get; } /// The face region where the comparison image's classification was made. public FaceRectangle FaceRectangle { get; } /// Quality of face image for recognition. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs index 48df626d12e3..f34e22a4cdbe 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessSessionAuditEntry : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifyResult : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,26 +28,19 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessSessionAuditEntry)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); - writer.WriteNumberValue(Id); - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - writer.WritePropertyName("receivedDateTime"u8); - writer.WriteStringValue(ReceivedDateTime, "O"); - writer.WritePropertyName("request"u8); - writer.WriteObjectValue(Request, options); - writer.WritePropertyName("response"u8); - writer.WriteObjectValue(Response, options); + if (Optional.IsDefined(LivenessDecision)) + { + writer.WritePropertyName("livenessDecision"u8); + writer.WriteStringValue(LivenessDecision.Value.ToString()); + } + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); writer.WritePropertyName("digest"u8); writer.WriteStringValue(Digest); if (Optional.IsDefined(SessionImageId)) @@ -55,6 +48,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("sessionImageId"u8); writer.WriteStringValue(SessionImageId); } + if (Optional.IsDefined(VerifyResult)) + { + writer.WritePropertyName("verifyResult"u8); + writer.WriteObjectValue(VerifyResult, options); + } if (Optional.IsDefined(VerifyImageHash)) { writer.WritePropertyName("verifyImageHash"u8); @@ -77,19 +75,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessSessionAuditEntry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifyResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessSessionAuditEntry)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessSessionAuditEntry(document.RootElement, options); + return DeserializeLivenessWithVerifyResult(document.RootElement, options); } - internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifyResult DeserializeLivenessWithVerifyResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -97,53 +95,28 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J { return null; } - long id = default; - string sessionId = default; - string requestId = default; - string clientRequestId = default; - DateTimeOffset receivedDateTime = default; - AuditRequestInfo request = default; - AuditLivenessResponseInfo response = default; + FaceLivenessDecision? livenessDecision = default; + LivenessDecisionTargets targets = default; string digest = default; string sessionImageId = default; + LivenessWithVerifyOutputs verifyResult = default; string verifyImageHash = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("sessionId"u8)) - { - sessionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) + if (property.NameEquals("livenessDecision"u8)) { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("receivedDateTime"u8)) - { - receivedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("request"u8)) - { - request = AuditRequestInfo.DeserializeAuditRequestInfo(property.Value, options); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + livenessDecision = new FaceLivenessDecision(property.Value.GetString()); continue; } - if (property.NameEquals("response"u8)) + if (property.NameEquals("targets"u8)) { - response = AuditLivenessResponseInfo.DeserializeAuditLivenessResponseInfo(property.Value, options); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } if (property.NameEquals("digest"u8)) @@ -156,6 +129,15 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J sessionImageId = property.Value.GetString(); continue; } + if (property.NameEquals("verifyResult"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + verifyResult = LivenessWithVerifyOutputs.DeserializeLivenessWithVerifyOutputs(property.Value, options); + continue; + } if (property.NameEquals("verifyImageHash"u8)) { verifyImageHash = property.Value.GetString(); @@ -167,57 +149,53 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessSessionAuditEntry( - id, - sessionId, - requestId, - clientRequestId, - receivedDateTime, - request, - response, + return new LivenessWithVerifyResult( + livenessDecision, + targets, digest, sessionImageId, + verifyResult, verifyImageHash, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(LivenessSessionAuditEntry)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support writing '{options.Format}' format."); } } - LivenessSessionAuditEntry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifyResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionAuditEntry(document.RootElement, options); + return DeserializeLivenessWithVerifyResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessSessionAuditEntry)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessSessionAuditEntry FromResponse(Response response) + internal static LivenessWithVerifyResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionAuditEntry(document.RootElement); + return DeserializeLivenessWithVerifyResult(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs new file mode 100644 index 000000000000..730d5cac8f3c --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness with verify call. + public partial class LivenessWithVerifyResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// or is null. + internal LivenessWithVerifyResult(LivenessDecisionTargets targets, string digest) + { + Argument.AssertNotNull(targets, nameof(targets)); + Argument.AssertNotNull(digest, nameof(digest)); + + Targets = targets; + Digest = digest; + } + + /// Initializes a new instance of . + /// The liveness classification for the target face. + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// The face verification output. Only available when the request is liveness with verify. + /// The sha256 hash of the verify-image in the request. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifyResult(FaceLivenessDecision? livenessDecision, LivenessDecisionTargets targets, string digest, string sessionImageId, LivenessWithVerifyOutputs verifyResult, string verifyImageHash, IDictionary serializedAdditionalRawData) + { + LivenessDecision = livenessDecision; + Targets = targets; + Digest = digest; + SessionImageId = sessionImageId; + VerifyResult = verifyResult; + VerifyImageHash = verifyImageHash; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifyResult() + { + } + + /// The liveness classification for the target face. + public FaceLivenessDecision? LivenessDecision { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + public string Digest { get; } + /// The image ID of the session request. + public string SessionImageId { get; } + /// The face verification output. Only available when the request is liveness with verify. + public LivenessWithVerifyOutputs VerifyResult { get; } + /// The sha256 hash of the verify-image in the request. + public string VerifyImageHash { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs index d025789726cf..e8db35212e75 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs @@ -36,35 +36,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W") { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) - { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId); } + writer.WritePropertyName("authToken"u8); + writer.WriteStringValue(AuthToken); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); - if (Optional.IsDefined(Result)) + if (Optional.IsDefined(ModelVersion)) { - writer.WritePropertyName("result"u8); - writer.WriteObjectValue(Result, options); + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion.Value.ToString()); } + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +87,42 @@ internal static LivenessWithVerifySession DeserializeLivenessWithVerifySession(J { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; - FaceSessionStatus status = default; - LivenessSessionAuditEntry result = default; + string sessionId = default; + string authToken = default; + OperationState status = default; + LivenessModel? modelVersion = default; + LivenessWithVerifySessionResults results = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("sessionId"u8)) { - id = property.Value.GetString(); + sessionId = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("authToken"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionStartDateTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) + if (property.NameEquals("status"u8)) { - deviceCorrelationId = property.Value.GetString(); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new FaceSessionStatus(property.Value.GetString()); + modelVersion = new LivenessModel(property.Value.GetString()); continue; } - if (property.NameEquals("result"u8)) + if (property.NameEquals("results"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - result = LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(property.Value, options); + results = LivenessWithVerifySessionResults.DeserializeLivenessWithVerifySessionResults(property.Value, options); continue; } if (options.Format != "W") @@ -173,14 +132,11 @@ internal static LivenessWithVerifySession DeserializeLivenessWithVerifySession(J } serializedAdditionalRawData = rawDataDictionary; return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, serializedAdditionalRawData); } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs index 9aaec1db8d47..5db8b918edbc 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs @@ -46,36 +46,34 @@ public partial class LivenessWithVerifySession private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// DateTime when this session was created. - /// Whether or not the session is expired. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - internal LivenessWithVerifySession(DateTimeOffset createdDateTime, bool sessionExpired, FaceSessionStatus status) + /// The results of the liveness with verify session. + /// or is null. + internal LivenessWithVerifySession(string authToken, OperationState status, LivenessWithVerifySessionResults results) { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; + Argument.AssertNotNull(authToken, nameof(authToken)); + Argument.AssertNotNull(results, nameof(results)); + + AuthToken = authToken; Status = status; + Results = results; } /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness with verify session. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifySession(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, FaceSessionStatus status, LivenessSessionAuditEntry result, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifySession(string sessionId, string authToken, OperationState status, LivenessModel? modelVersion, LivenessWithVerifySessionResults results, IDictionary serializedAdditionalRawData) { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + SessionId = sessionId; + AuthToken = authToken; Status = status; - Result = result; + ModelVersion = modelVersion; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +83,14 @@ internal LivenessWithVerifySession() } /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { get; } - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - public string DeviceCorrelationId { get; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } + public string SessionId { get; } + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. + public string AuthToken { get; } /// The current status of the session. - public FaceSessionStatus Status { get; } - /// The latest session audit result only populated if status == 'ResultAvailable'. - public LivenessSessionAuditEntry Result { get; } + public OperationState Status { get; } + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + public LivenessModel? ModelVersion { get; } + /// The results of the liveness with verify session. + public LivenessWithVerifySessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs similarity index 51% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs index e86fb126c760..97f9fadec5e6 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessSessionItem : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifySessionAttempt : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,35 +28,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessSessionItem)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support writing '{format}' format."); } - if (options.Format != "W") + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) + if (Optional.IsDefined(Error)) { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -75,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessSessionItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifySessionAttempt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessSessionItem)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessSessionItem(document.RootElement, options); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); } - internal static LivenessSessionItem DeserializeLivenessSessionItem(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifySessionAttempt DeserializeLivenessWithVerifySessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -95,52 +85,40 @@ internal static LivenessSessionItem DeserializeLivenessSessionItem(JsonElement e { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; + int attemptId = default; + OperationState attemptStatus = default; + LivenessWithVerifyResult result = default; + LivenessError error = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("attemptId"u8)) { - id = property.Value.GetString(); + attemptId = property.Value.GetInt32(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("attemptStatus"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); + attemptStatus = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("sessionStartDateTime"u8)) + if (property.NameEquals("result"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) - { - deviceCorrelationId = property.Value.GetString(); + result = LivenessWithVerifyResult.DeserializeLivenessWithVerifyResult(property.Value, options); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("error"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); + error = LivenessError.DeserializeLivenessError(property.Value, options); continue; } if (options.Format != "W") @@ -149,53 +127,46 @@ internal static LivenessSessionItem DeserializeLivenessSessionItem(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessSessionItem( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, - serializedAdditionalRawData); + return new LivenessWithVerifySessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(LivenessSessionItem)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support writing '{options.Format}' format."); } } - LivenessSessionItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifySessionAttempt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionItem(document.RootElement, options); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessSessionItem)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessSessionItem FromResponse(Response response) + internal static LivenessWithVerifySessionAttempt FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionItem(document.RootElement); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs new file mode 100644 index 000000000000..947837cf1967 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The liveness with verify session attempt. + public partial class LivenessWithVerifySessionAttempt + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + internal LivenessWithVerifySessionAttempt(int attemptId, OperationState attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + } + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness with verify call, will be null if there is error. + /// The error of the liveness with verify call, will be null if there is result. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifySessionAttempt(int attemptId, OperationState attemptStatus, LivenessWithVerifyResult result, LivenessError error, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifySessionAttempt() + { + } + + /// The attempt ID, start from 1. + public int AttemptId { get; } + /// The status of the attempt. + public OperationState AttemptStatus { get; } + /// The result of the liveness with verify call, will be null if there is error. + public LivenessWithVerifyResult Result { get; } + /// The error of the liveness with verify call, will be null if there is result. + public LivenessError Error { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs new file mode 100644 index 000000000000..9a8dda439b7b --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Vision.Face +{ + public partial class LivenessWithVerifySessionResults : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessWithVerifySessionResults)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("verifyReferences"u8); + writer.WriteStartArray(); + foreach (var item in VerifyReferences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("attempts"u8); + writer.WriteStartArray(); + foreach (var item in Attempts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessWithVerifySessionResults IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessWithVerifySessionResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessWithVerifySessionResults(document.RootElement, options); + } + + internal static LivenessWithVerifySessionResults DeserializeLivenessWithVerifySessionResults(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList verifyReferences = default; + IReadOnlyList attempts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verifyReferences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessWithVerifyReference.DeserializeLivenessWithVerifyReference(item, options)); + } + verifyReferences = array; + continue; + } + if (property.NameEquals("attempts"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessWithVerifySessionAttempt.DeserializeLivenessWithVerifySessionAttempt(item, options)); + } + attempts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessWithVerifySessionResults(verifyReferences, attempts, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LivenessWithVerifySessionResults)} does not support writing '{options.Format}' format."); + } + } + + LivenessWithVerifySessionResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessWithVerifySessionResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessWithVerifySessionResults)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessWithVerifySessionResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessWithVerifySessionResults(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs new file mode 100644 index 000000000000..570a83f964c2 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness with verify session. + public partial class LivenessWithVerifySessionResults + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// or is null. + internal LivenessWithVerifySessionResults(IEnumerable verifyReferences, IEnumerable attempts) + { + Argument.AssertNotNull(verifyReferences, nameof(verifyReferences)); + Argument.AssertNotNull(attempts, nameof(attempts)); + + VerifyReferences = verifyReferences.ToList(); + Attempts = attempts.ToList(); + } + + /// Initializes a new instance of . + /// The references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifySessionResults(IReadOnlyList verifyReferences, IReadOnlyList attempts, IDictionary serializedAdditionalRawData) + { + VerifyReferences = verifyReferences; + Attempts = attempts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifySessionResults() + { + } + + /// The references used for face verification. + public IReadOnlyList VerifyReferences { get; } + /// The attempts data of underlying liveness with verify call with the session. + public IReadOnlyList Attempts { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs new file mode 100644 index 000000000000..11c8033fba6a --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Vision.Face +{ + /// Enum describing allowed operation states. + public readonly partial struct OperationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "NotStarted"; + private const string RunningValue = "Running"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// The operation has not started. + public static OperationState NotStarted { get; } = new OperationState(NotStartedValue); + /// The operation is in progress. + public static OperationState Running { get; } = new OperationState(RunningValue); + /// The operation has completed successfully. + public static OperationState Succeeded { get; } = new OperationState(SucceededValue); + /// The operation has failed. + public static OperationState Failed { get; } = new OperationState(FailedValue); + /// The operation has been canceled by the user. + public static OperationState Canceled { get; } = new OperationState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(OperationState left, OperationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationState left, OperationState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationState(string value) => new OperationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationState other && Equals(other); + /// + public bool Equals(OperationState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs index b793cf92c5e9..01e05583b87c 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs @@ -28,8 +28,7 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession( using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -38,6 +37,9 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession( JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -51,8 +53,7 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -61,6 +62,9 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -73,12 +77,11 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession_ CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; - Response response = client.CreateLivenessSession(body); + Response response = client.CreateLivenessSession(body); } [Test] @@ -91,12 +94,11 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; - Response response = await client.CreateLivenessSessionAsync(body); + Response response = await client.CreateLivenessSessionAsync(body); } [Test] @@ -136,10 +138,11 @@ public void Example_LivenessSession_GetLivenessSessionResult_GetLivenessSessionR Response response = client.GetLivenessSessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -153,10 +156,11 @@ public async Task Example_LivenessSession_GetLivenessSessionResult_GetLivenessSe Response response = await client.GetLivenessSessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -183,128 +187,76 @@ public async Task Example_LivenessSession_GetLivenessSessionResult_GetLivenessSe [Test] [Ignore("Only validating compilation of examples")] - public void Example_LivenessSession_GetLivenessSessions_GetLivenessSessions() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessSessions("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = await client.GetLivenessSessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessSessions(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Convenience_Async() + public void Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response> response = await client.GetLivenessSessionsAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); + using RequestContent content = null; + Response response = client.CreateLivenessWithVerifySession(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Async() + public async Task Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); + using RequestContent content = null; + Response response = await client.CreateLivenessWithVerifySessionAsync(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Convenience() + public void Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response> response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); + CreateLivenessWithVerifySessionContent body = null; + Response response = client.CreateLivenessWithVerifySession(body); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Convenience_Async() + public async Task Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response> response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); + CreateLivenessWithVerifySessionContent body = null; + Response response = await client.CreateLivenessWithVerifySessionAsync(body); } [Test] @@ -344,10 +296,17 @@ public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessionResult Response response = client.GetLivenessWithVerifySessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -361,10 +320,17 @@ public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySession Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -389,132 +355,6 @@ public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySession Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); } - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessWithVerifySessions("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = await client.GetLivenessWithVerifySessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessWithVerifySessions(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = await client.GetLivenessWithVerifySessionsAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); - } - [Test] [Ignore("Only validating compilation of examples")] public void Example_FaceSessionClient_DetectFromSessionImage_DetectFromSessionImageId() diff --git a/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml index 04929cc061e0..1c2aea1004ee 100644 --- a/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml +++ b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Face -commit: 3eeb18be88d0d6ca7b0a365df1e4122c01c9e84b +commit: f79d4ed573ec12a63917b01e54baeaa52a914f3f repo: Azure/azure-rest-api-specs - +additionalDirectories: diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/Azure.Developer.LoadTesting.sln b/sdk/loadtesting/Azure.Developer.LoadTesting/Azure.Developer.LoadTesting.sln new file mode 100644 index 000000000000..fb32820aaea6 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/Azure.Developer.LoadTesting.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Developer.LoadTesting", "src\Azure.Developer.LoadTesting.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Developer.LoadTesting.Tests", "tests\Azure.Developer.LoadTesting.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/CHANGELOG.md b/sdk/loadtesting/Azure.Developer.LoadTesting/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/Directory.Build.props b/sdk/loadtesting/Azure.Developer.LoadTesting/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/README.md b/sdk/loadtesting/Azure.Developer.LoadTesting/README.md new file mode 100644 index 000000000000..09c7f0c5f2cd --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/README.md @@ -0,0 +1,107 @@ +# Azure.Developer.LoadTesting client library for .NET + +Azure.Developer.LoadTesting is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/loadtesting/Azure.Developer.LoadTesting/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.Developer.LoadTesting --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +### Service API versions + +The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version. + +For example, + +```C# Snippet:CreateClientForSpecificApiVersion +Uri endpoint = new Uri(""); +DefaultAzureCredential credential = new DefaultAzureCredential(); +ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.) +var client = new Client(endpoint, credential, options); +``` + +When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/loadtesting/Azure.Developer.LoadTesting/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/loadtesting/Azure.Developer.LoadTesting/README.png) \ No newline at end of file diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Azure.Developer.LoadTesting.csproj b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Azure.Developer.LoadTesting.csproj new file mode 100644 index 000000000000..e46421196dcf --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Azure.Developer.LoadTesting.csproj @@ -0,0 +1,19 @@ + + + This is the Azure.Developer.LoadTesting client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.Developer.LoadTesting for Azure Data Plane + 1.0.0-beta.1 + Azure.Developer.LoadTesting + $(RequiredTargetFrameworks) + true + + + + + + + + + + + diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AggregationType.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AggregationType.cs new file mode 100644 index 000000000000..76917e3b3797 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AggregationType.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Aggregation type. + public readonly partial struct AggregationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AggregationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AverageValue = "Average"; + private const string CountValue = "Count"; + private const string NoneValue = "None"; + private const string TotalValue = "Total"; + private const string Percentile75Value = "Percentile75"; + private const string Percentile90Value = "Percentile90"; + private const string Percentile95Value = "Percentile95"; + private const string Percentile96Value = "Percentile96"; + private const string Percentile97Value = "Percentile97"; + private const string Percentile98Value = "Percentile98"; + private const string Percentile99Value = "Percentile99"; + private const string Percentile999Value = "Percentile999"; + private const string Percentile9999Value = "Percentile9999"; + + /// Average value. + public static AggregationType Average { get; } = new AggregationType(AverageValue); + /// Total count. + public static AggregationType Count { get; } = new AggregationType(CountValue); + /// Aggregation will be average in this case. + public static AggregationType None { get; } = new AggregationType(NoneValue); + /// Total sum. + public static AggregationType Total { get; } = new AggregationType(TotalValue); + /// 75th percentile. + public static AggregationType Percentile75 { get; } = new AggregationType(Percentile75Value); + /// 90th percentile. + public static AggregationType Percentile90 { get; } = new AggregationType(Percentile90Value); + /// 95th percentile. + public static AggregationType Percentile95 { get; } = new AggregationType(Percentile95Value); + /// 96th percentile. + public static AggregationType Percentile96 { get; } = new AggregationType(Percentile96Value); + /// 97th percentile. + public static AggregationType Percentile97 { get; } = new AggregationType(Percentile97Value); + /// 98th percentile. + public static AggregationType Percentile98 { get; } = new AggregationType(Percentile98Value); + /// 99th percentile. + public static AggregationType Percentile99 { get; } = new AggregationType(Percentile99Value); + /// 99.9th percentile. + public static AggregationType Percentile999 { get; } = new AggregationType(Percentile999Value); + /// 99.99th percentile. + public static AggregationType Percentile9999 { get; } = new AggregationType(Percentile9999Value); + /// Determines if two values are the same. + public static bool operator ==(AggregationType left, AggregationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AggregationType left, AggregationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AggregationType(string value) => new AggregationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AggregationType other && Equals(other); + /// + public bool Equals(AggregationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ArtifactsContainerInfo.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ArtifactsContainerInfo.Serialization.cs new file mode 100644 index 000000000000..ccdf31a21bfe --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ArtifactsContainerInfo.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class ArtifactsContainerInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArtifactsContainerInfo)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (Optional.IsDefined(ExpiresOn)) + { + writer.WritePropertyName("expireDateTime"u8); + writer.WriteStringValue(ExpiresOn.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArtifactsContainerInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArtifactsContainerInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactsContainerInfo(document.RootElement, options); + } + + internal static ArtifactsContainerInfo DeserializeArtifactsContainerInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri url = default; + DateTimeOffset? expireDateTime = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("url"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + url = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("expireDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expireDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArtifactsContainerInfo(url, expireDateTime, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ArtifactsContainerInfo)} does not support writing '{options.Format}' format."); + } + } + + ArtifactsContainerInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArtifactsContainerInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArtifactsContainerInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ArtifactsContainerInfo FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArtifactsContainerInfo(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ArtifactsContainerInfo.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ArtifactsContainerInfo.cs new file mode 100644 index 000000000000..6c3025c73388 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ArtifactsContainerInfo.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Artifacts container info. + public partial class ArtifactsContainerInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ArtifactsContainerInfo() + { + } + + /// Initializes a new instance of . + /// This is a SAS URI to an Azure Storage Container that contains the test run artifacts. + /// Expiry time of the container (RFC 3339 literal format). + /// Keeps track of any properties unknown to the library. + internal ArtifactsContainerInfo(Uri uri, DateTimeOffset? expiresOn, IDictionary serializedAdditionalRawData) + { + Uri = uri; + ExpiresOn = expiresOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// This is a SAS URI to an Azure Storage Container that contains the test run artifacts. + public Uri Uri { get; } + /// Expiry time of the container (RFC 3339 literal format). + public DateTimeOffset? ExpiresOn { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AutoStopCriteria.Serialization.cs similarity index 60% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs rename to sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AutoStopCriteria.Serialization.cs index 3a81222297b3..f5757e2ba134 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AutoStopCriteria.Serialization.cs @@ -11,13 +11,13 @@ using System.Text.Json; using Azure.Core; -namespace Azure.AI.Vision.Face +namespace Azure.Developer.LoadTesting { - public partial class AuditRequestInfo : IUtf8JsonSerializable, IJsonModel + public partial class AutoStopCriteria : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,27 +28,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AutoStopCriteria)} does not support writing '{format}' format."); } - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - writer.WritePropertyName("method"u8); - writer.WriteStringValue(Method); - if (Optional.IsDefined(ContentLength)) + if (Optional.IsDefined(AutoStopDisabled)) { - writer.WritePropertyName("contentLength"u8); - writer.WriteNumberValue(ContentLength.Value); + writer.WritePropertyName("autoStopDisabled"u8); + writer.WriteBooleanValue(AutoStopDisabled.Value); } - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - if (Optional.IsDefined(UserAgent)) + if (Optional.IsDefined(ErrorRate)) { - writer.WritePropertyName("userAgent"u8); - writer.WriteStringValue(UserAgent); + writer.WritePropertyName("errorRate"u8); + writer.WriteNumberValue(ErrorRate.Value); + } + if (Optional.IsDefined(ErrorRateTimeWindow)) + { + writer.WritePropertyName("errorRateTimeWindowInSeconds"u8); + writer.WriteNumberValue(Convert.ToInt32(ErrorRateTimeWindow.Value.ToString("%s"))); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -67,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AuditRequestInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AutoStopCriteria IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AutoStopCriteria)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeAutoStopCriteria(document.RootElement, options); } - internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static AutoStopCriteria DeserializeAutoStopCriteria(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,42 +86,38 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element { return null; } - string url = default; - string method = default; - long? contentLength = default; - string contentType = default; - string userAgent = default; + bool? autoStopDisabled = default; + float? errorRate = default; + TimeSpan? errorRateTimeWindowInSeconds = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("method"u8)) - { - method = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentLength"u8)) + if (property.NameEquals("autoStopDisabled"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - contentLength = property.Value.GetInt64(); + autoStopDisabled = property.Value.GetBoolean(); continue; } - if (property.NameEquals("contentType"u8)) + if (property.NameEquals("errorRate"u8)) { - contentType = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorRate = property.Value.GetSingle(); continue; } - if (property.NameEquals("userAgent"u8)) + if (property.NameEquals("errorRateTimeWindowInSeconds"u8)) { - userAgent = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorRateTimeWindowInSeconds = TimeSpan.FromSeconds(property.Value.GetInt32()); continue; } if (options.Format != "W") @@ -131,52 +126,46 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new AuditRequestInfo( - url, - method, - contentLength, - contentType, - userAgent, - serializedAdditionalRawData); + return new AutoStopCriteria(autoStopDisabled, errorRate, errorRateTimeWindowInSeconds, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoStopCriteria)} does not support writing '{options.Format}' format."); } } - AuditRequestInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AutoStopCriteria IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeAutoStopCriteria(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoStopCriteria)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static AuditRequestInfo FromResponse(Response response) + internal static AutoStopCriteria FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditRequestInfo(document.RootElement); + return DeserializeAutoStopCriteria(document.RootElement); } /// Convert into a . diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AutoStopCriteria.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AutoStopCriteria.cs new file mode 100644 index 000000000000..62add74aaf58 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AutoStopCriteria.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. + public partial class AutoStopCriteria + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AutoStopCriteria() + { + } + + /// Initializes a new instance of . + /// Whether auto-stop should be disabled. The default value is false. + /// Threshold percentage of errors on which test run should be automatically stopped. Allowed values are in range of 0.0-100.0. + /// Time window during which the error percentage should be evaluated in seconds. + /// Keeps track of any properties unknown to the library. + internal AutoStopCriteria(bool? autoStopDisabled, float? errorRate, TimeSpan? errorRateTimeWindow, IDictionary serializedAdditionalRawData) + { + AutoStopDisabled = autoStopDisabled; + ErrorRate = errorRate; + ErrorRateTimeWindow = errorRateTimeWindow; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether auto-stop should be disabled. The default value is false. + public bool? AutoStopDisabled { get; set; } + /// Threshold percentage of errors on which test run should be automatically stopped. Allowed values are in range of 0.0-100.0. + public float? ErrorRate { get; set; } + /// Time window during which the error percentage should be evaluated in seconds. + public TimeSpan? ErrorRateTimeWindow { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AzureDeveloperLoadTestingClientOptions.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AzureDeveloperLoadTestingClientOptions.cs new file mode 100644 index 000000000000..182a9afccf68 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/AzureDeveloperLoadTestingClientOptions.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// Client options for Azure.Developer.LoadTesting library clients. + public partial class AzureDeveloperLoadTestingClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2024_12_01_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2022-11-01". + V2022_11_01 = 1, + /// Service version "2023-04-01-preview". + V2023_04_01_Preview = 2, + /// Service version "2024-03-01-preview". + V2024_03_01_Preview = 3, + /// Service version "2024-05-01-preview". + V2024_05_01_Preview = 4, + /// Service version "2024-07-01-preview". + V2024_07_01_Preview = 5, + /// Service version "2024-12-01-preview". + V2024_12_01_Preview = 6, + } + + internal string Version { get; } + + /// Initializes new instance of AzureDeveloperLoadTestingClientOptions. + public AzureDeveloperLoadTestingClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2022_11_01 => "2022-11-01", + ServiceVersion.V2023_04_01_Preview => "2023-04-01-preview", + ServiceVersion.V2024_03_01_Preview => "2024-03-01-preview", + ServiceVersion.V2024_05_01_Preview => "2024-05-01-preview", + ServiceVersion.V2024_07_01_Preview => "2024-07-01-preview", + ServiceVersion.V2024_12_01_Preview => "2024-12-01-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/CertificateType.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/CertificateType.cs new file mode 100644 index 000000000000..2d4b2cc0ea64 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/CertificateType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Types of certificates supported. + public readonly partial struct CertificateType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CertificateType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string KeyVaultCertificateUriValue = "AKV_CERT_URI"; + + /// If the certificate is stored in an Azure Key Vault. + public static CertificateType KeyVaultCertificateUri { get; } = new CertificateType(KeyVaultCertificateUriValue); + /// Determines if two values are the same. + public static bool operator ==(CertificateType left, CertificateType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CertificateType left, CertificateType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CertificateType(string value) => new CertificateType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CertificateType other && Equals(other); + /// + public bool Equals(CertificateType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/CreatedByType.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/CreatedByType.cs new file mode 100644 index 000000000000..07698168cca2 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/CreatedByType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// The type of the entity that created the test run. (E.x. User, ScheduleTrigger, etc). + public readonly partial struct CreatedByType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CreatedByType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string ScheduledTriggerValue = "ScheduledTrigger"; + + /// Entity was created by a user. + public static CreatedByType User { get; } = new CreatedByType(UserValue); + /// Entity was created by a scheduled trigger. + public static CreatedByType ScheduledTrigger { get; } = new CreatedByType(ScheduledTriggerValue); + /// Determines if two values are the same. + public static bool operator ==(CreatedByType left, CreatedByType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CreatedByType left, CreatedByType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CreatedByType(string value) => new CreatedByType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CreatedByType other && Equals(other); + /// + public bool Equals(CreatedByType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DeveloperLoadTestingClientBuilderExtensions.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DeveloperLoadTestingClientBuilderExtensions.cs new file mode 100644 index 000000000000..6d76257f95b6 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DeveloperLoadTestingClientBuilderExtensions.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core.Extensions; +using Azure.Developer.LoadTesting; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add , to client builder. + public static partial class DeveloperLoadTestingClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// The to use. + public static IAzureClientBuilder AddLoadTestAdministrationClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new LoadTestAdministrationClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The to use. + public static IAzureClientBuilder AddLoadTestRunClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new LoadTestRunClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddLoadTestAdministrationClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddLoadTestRunClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DeveloperLoadTestingModelFactory.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DeveloperLoadTestingModelFactory.cs new file mode 100644 index 000000000000..87493a806840 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DeveloperLoadTestingModelFactory.cs @@ -0,0 +1,773 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// Model factory for models. + public static partial class DeveloperLoadTestingModelFactory + { + /// Initializes a new instance of . + /// Pass fail criteria for a test. + /// Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. + /// + /// Secrets can be stored in an Azure Key Vault or any other secret store. If the + /// secret is stored in an Azure Key Vault, the value should be the secret + /// identifier and the type should be AKV_SECRET_URI. If the secret is stored + /// elsewhere, the secret value should be provided directly and the type should be + /// SECRET_VALUE. + /// + /// Certificates metadata. + /// Environment variables which are defined as a set of <name,value> pairs. + /// The load test configuration. + /// Id of the test run to be marked as baseline to view trends of client-side metrics from recent test runs. + /// The input artifacts for the test. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The test description. + /// Display name of a test. + /// Subnet ID on which the load test instances should run. + /// Kind of test. + /// Inject load test engines without deploying public IP for outbound access. + /// Type of the managed identity referencing the Key vault. + /// Resource Id of the managed identity referencing the Key vault. + /// Type of the managed identity referencing the metrics. + /// Resource Id of the managed identity referencing the metrics. + /// Type of the managed identity built in load test engines. + /// Resource Ids of the managed identity built in to load test engines. Required if engineBuiltInIdentityType is UserAssigned. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static LoadTest LoadTest(PassFailCriteria passFailCriteria = null, AutoStopCriteria autoStopCriteria = null, IDictionary secrets = null, TestCertificate certificate = null, IDictionary environmentVariables = null, LoadTestConfiguration loadTestConfiguration = null, string baselineTestRunId = null, TestInputArtifacts inputArtifacts = null, string testId = null, string description = null, string displayName = null, string subnetId = null, LoadTestKind? kind = null, bool? publicIpDisabled = null, string keyvaultReferenceIdentityType = null, string keyvaultReferenceIdentityId = null, LoadTestingManagedIdentityType? metricsReferenceIdentityType = null, string metricsReferenceIdentityId = null, LoadTestingManagedIdentityType? engineBuiltInIdentityType = null, IEnumerable engineBuiltInIdentityIds = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + secrets ??= new Dictionary(); + environmentVariables ??= new Dictionary(); + engineBuiltInIdentityIds ??= new List(); + + return new LoadTest( + passFailCriteria, + autoStopCriteria, + secrets, + certificate, + environmentVariables, + loadTestConfiguration, + baselineTestRunId, + inputArtifacts, + testId, + description, + displayName, + subnetId, + kind, + publicIpDisabled, + keyvaultReferenceIdentityType, + keyvaultReferenceIdentityId, + metricsReferenceIdentityType, + metricsReferenceIdentityId, + engineBuiltInIdentityType, + engineBuiltInIdentityIds?.ToList(), + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The client metric on which the criteria should be applied. + /// + /// The aggregation function to be applied on the client metric. Allowed functions + /// - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, + /// ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + /// ‘count’ - for requests + /// + /// The comparison operator. Supported types ‘>’, ‘<’. + /// Request name for which the Pass fail criteria has to be applied. + /// + /// The value to compare with the client metric. Allowed values - ‘error : [0.0 , + /// 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + /// + /// Action taken after the threshold is met. Default is ‘continue’. + /// The actual value of the client metric for the test run. + /// Outcome of the test run. + /// A new instance for mocking. + public static PassFailMetric PassFailMetric(PfMetrics? clientMetric = null, PassFailAggregationFunction? aggregate = null, string condition = null, string requestName = null, double? value = null, PassFailAction? action = null, double? actualValue = null, PassFailResult? result = null) + { + return new PassFailMetric( + clientMetric, + aggregate, + condition, + requestName, + value, + action, + actualValue, + result, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource id of the resource emitting the metric. + /// The server metric namespace. + /// The server metric name. + /// Aggregation Type. + /// The comparison operator. Supported types ‘>’, ‘<’. + /// The value to compare with the server metric. + /// Action taken after the threshold is met. Default is ‘continue’. + /// The actual value of the server metric. + /// Outcome of the test run. + /// A new instance for mocking. + public static PassFailServerMetric PassFailServerMetric(ResourceIdentifier resourceId = null, string metricNamespace = null, string metricName = null, string aggregation = null, string condition = null, double value = default, PassFailAction? action = null, double? actualValue = null, PassFailResult? result = null) + { + return new PassFailServerMetric( + resourceId, + metricNamespace, + metricName, + aggregation, + condition, + value, + action, + actualValue, + result, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The load test YAML file that contains the the test configuration. + /// The test script file for the test run. + /// The user properties file. + /// The zip file with all input artifacts. + /// The config json file for url based test. + /// Additional supported files for the test run. + /// A new instance for mocking. + public static TestInputArtifacts TestInputArtifacts(TestFileInfo configFileInfo = null, TestFileInfo testScriptFileInfo = null, TestFileInfo userPropertyFileInfo = null, TestFileInfo inputArtifactsZipFileInfo = null, TestFileInfo urlTestConfigFileInfo = null, IEnumerable additionalFileInfo = null) + { + additionalFileInfo ??= new List(); + + return new TestInputArtifacts( + configFileInfo, + testScriptFileInfo, + userPropertyFileInfo, + inputArtifactsZipFileInfo, + urlTestConfigFileInfo, + additionalFileInfo?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the file. + /// File URL. + /// File type. + /// Expiry time of the file (RFC 3339 literal format). + /// Validation status of the file. + /// Validation failure error details. + /// A new instance for mocking. + public static TestFileInfo TestFileInfo(string fileName = null, Uri uri = null, LoadTestingFileType? fileType = null, DateTimeOffset? expiresOn = null, FileValidationStatus? validationStatus = null, string validationFailureDetails = null) + { + return new TestFileInfo( + fileName, + uri, + fileType, + expiresOn, + validationStatus, + validationFailureDetails, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + /// Test identifier. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static TestAppComponents TestAppComponents(IDictionary components = null, string testId = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + components ??= new Dictionary(); + + return new TestAppComponents( + components, + testId, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + /// Azure resource name, required while creating the app component. + /// Azure resource type, required while creating the app component. + /// Azure resource display name. + /// Resource group name of the Azure resource. + /// Subscription Id of the Azure resource. + /// Kind of Azure resource type. + /// A new instance for mocking. + public static LoadTestingAppComponent LoadTestingAppComponent(ResourceIdentifier resourceId = null, string resourceName = null, string resourceType = null, string displayName = null, string resourceGroup = null, string subscriptionId = null, string kind = null) + { + return new LoadTestingAppComponent( + resourceId, + resourceName, + resourceType, + displayName, + resourceGroup, + subscriptionId, + kind, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Test identifier. + /// + /// Azure resource metrics collection {metric id : metrics object} (Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + /// for metric id). + /// + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static TestServerMetricsConfiguration TestServerMetricsConfiguration(string testId = null, IDictionary metrics = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + metrics ??= new Dictionary(); + + return new TestServerMetricsConfiguration( + testId, + metrics, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique name for metric. + /// Azure resource id. + /// Metric name space. + /// Metric description. + /// The invariant value of metric name. + /// Metric aggregation. + /// Metric unit. + /// Azure resource type. + /// A new instance for mocking. + public static ResourceMetric ResourceMetric(string id = null, ResourceIdentifier resourceId = null, string metricNamespace = null, string displayDescription = null, string name = null, string aggregation = null, string unit = null, string resourceType = null) + { + return new ResourceMetric( + id, + resourceId, + metricNamespace, + displayDescription, + name, + aggregation, + unit, + resourceType, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Display name of the test profile. + /// Description for the test profile. + /// Associated test ID for the test profile. This property is required for creating a Test Profile and it's not allowed to be updated. + /// Target resource ID on which the test profile is created. This property is required for creating a Test Profile and it's not allowed to be updated. + /// + /// Configurations of the target resource on which testing would be done. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static TestProfile TestProfile(string testProfileId = null, string displayName = null, string description = null, string testId = null, ResourceIdentifier targetResourceId = null, TargetResourceConfigurations targetResourceConfigurations = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + return new TestProfile( + testProfileId, + displayName, + description, + testId, + targetResourceId, + targetResourceConfigurations, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Pass fail criteria for a test. + /// Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. + /// + /// Secrets can be stored in an Azure Key Vault or any other secret store. If the + /// secret is stored in an Azure Key Vault, the value should be the secret + /// identifier and the type should be AKV_SECRET_URI. If the secret is stored + /// elsewhere, the secret value should be provided directly and the type should be + /// SECRET_VALUE. + /// + /// Certificates metadata. + /// Environment variables which are defined as a set of <name,value> pairs. + /// Error details if there is any failure in load test run. + /// + /// Test run statistics. Key is the sampler name and value is the set of statistics for performance metrics like response time, throughput, etc. from the load test run. + /// The sampler name is the same as the name mentioned in the test script. + /// Sampler name "Total" represents the aggregated statistics of all the samplers. + /// + /// + /// Regional statistics. Key is the Azure region name and value is the test run statistics. + /// The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For example, East US should be passed as "eastus". + /// The region name must match one of the strings in the "Name" column returned from running the "az account list-locations -o table" Azure CLI command. + /// + /// The load test configuration. + /// Collection of test run artifacts. + /// Test result for pass/Fail criteria used during the test run. + /// Number of virtual users, for which test has been run. + /// Display name of a testRun. + /// Associated test Id. + /// The test run description. + /// The test run status. + /// The test run start DateTime(RFC 3339 literal format). + /// The test run end DateTime(RFC 3339 literal format). + /// Test run initiated time. + /// Portal url. + /// Test run duration in milliseconds. + /// Virtual user hours consumed by the test run. + /// Subnet ID on which the load test instances should run. + /// Type of test. + /// Request data collection level for test run. + /// Enable or disable debug level logging. True if debug logs are enabled for the test run. False otherwise. + /// Inject load test engines without deploying public IP for outbound access. + /// The type of the entity that created the test run. (E.x. User, ScheduleTrigger, etc). + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static LoadTestRun LoadTestRun(string testRunId = null, PassFailCriteria passFailCriteria = null, AutoStopCriteria autoStopCriteria = null, IDictionary secrets = null, TestCertificate certificate = null, IDictionary environmentVariables = null, IEnumerable errorDetails = null, IReadOnlyDictionary testRunStatistics = null, IReadOnlyDictionary regionalStatistics = null, LoadTestConfiguration loadTestConfiguration = null, TestRunArtifacts testArtifacts = null, PassFailTestResult? testResult = null, int? virtualUsers = null, string displayName = null, string testId = null, string description = null, TestRunStatus? status = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, DateTimeOffset? executedDateTime = null, Uri portalUri = null, long? duration = null, double? virtualUserHours = null, string subnetId = null, LoadTestKind? kind = null, RequestDataLevel? requestDataLevel = null, bool? debugLogsEnabled = null, bool? publicIpDisabled = null, CreatedByType? createdByType = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + secrets ??= new Dictionary(); + environmentVariables ??= new Dictionary(); + errorDetails ??= new List(); + testRunStatistics ??= new Dictionary(); + regionalStatistics ??= new Dictionary(); + + return new LoadTestRun( + testRunId, + passFailCriteria, + autoStopCriteria, + secrets, + certificate, + environmentVariables, + errorDetails?.ToList(), + testRunStatistics, + regionalStatistics, + loadTestConfiguration, + testArtifacts, + testResult, + virtualUsers, + displayName, + testId, + description, + status, + startDateTime, + endDateTime, + executedDateTime, + portalUri, + duration, + virtualUserHours, + subnetId, + kind, + requestDataLevel, + debugLogsEnabled, + publicIpDisabled, + createdByType, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Error details in case test run was not successfully run. + /// A new instance for mocking. + public static ErrorDetails ErrorDetails(string message = null) + { + return new ErrorDetails(message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Transaction name. + /// Sampler count. + /// Error count. + /// Error percentage. + /// Mean response time. + /// Median response time. + /// Max response time. + /// Minimum response time. + /// 90 percentile response time. + /// 95 percentile response time. + /// 99 percentile response time. + /// 75 percentile response time. + /// 96 percentile response time. + /// 97 percentile response time. + /// 98 percentile response time. + /// 99.9 percentile response time. + /// 99.99 percentile response time. + /// Throughput. + /// Received network bytes. + /// Send network bytes. + /// A new instance for mocking. + public static TestRunStatistics TestRunStatistics(string transaction = null, double? sampleCount = null, double? errorCount = null, double? errorPercentage = null, double? meanResponseTime = null, double? medianResponseTime = null, double? maxResponseTime = null, double? minResponseTime = null, double? percentile90ResponseTime = null, double? percentile95ResponseTime = null, double? percentile99ResponseTime = null, double? percentile75ResponseTime = null, double? percentile96ResponseTime = null, double? percentile97ResponseTime = null, double? percentile98ResponseTime = null, double? percentile999ResponseTime = null, double? percentile9999ResponseTime = null, double? throughput = null, double? receivedKBytesPerSec = null, double? sentKBytesPerSec = null) + { + return new TestRunStatistics( + transaction, + sampleCount, + errorCount, + errorPercentage, + meanResponseTime, + medianResponseTime, + maxResponseTime, + minResponseTime, + percentile90ResponseTime, + percentile95ResponseTime, + percentile99ResponseTime, + percentile75ResponseTime, + percentile96ResponseTime, + percentile97ResponseTime, + percentile98ResponseTime, + percentile999ResponseTime, + percentile9999ResponseTime, + throughput, + receivedKBytesPerSec, + sentKBytesPerSec, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The input artifacts for the test run. + /// The output artifacts for the test run. + /// A new instance for mocking. + public static TestRunArtifacts TestRunArtifacts(TestRunInputArtifacts inputArtifacts = null, TestRunOutputArtifacts outputArtifacts = null) + { + return new TestRunArtifacts(inputArtifacts, outputArtifacts, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The load test YAML file that contains the the test configuration. + /// The test script file for the test run. + /// The user properties file. + /// The zip file for all input artifacts. + /// The config json file for url based test. + /// Additional supported files for the test run. + /// A new instance for mocking. + public static TestRunInputArtifacts TestRunInputArtifacts(TestRunFileInfo configFileInfo = null, TestRunFileInfo testScriptFileInfo = null, TestRunFileInfo userPropertyFileInfo = null, TestRunFileInfo inputArtifactsZipFileInfo = null, TestRunFileInfo urlTestConfigFileInfo = null, IEnumerable additionalFileInfo = null) + { + additionalFileInfo ??= new List(); + + return new TestRunInputArtifacts( + configFileInfo, + testScriptFileInfo, + userPropertyFileInfo, + inputArtifactsZipFileInfo, + urlTestConfigFileInfo, + additionalFileInfo?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the file. + /// File URL. + /// File type. + /// Expiry time of the file (RFC 3339 literal format). + /// Validation status of the file. + /// Validation failure error details. + /// A new instance for mocking. + public static TestRunFileInfo TestRunFileInfo(string fileName = null, Uri uri = null, LoadTestingFileType? fileType = null, DateTimeOffset? expiresOn = null, FileValidationStatus? validationStatus = null, string validationFailureDetails = null) + { + return new TestRunFileInfo( + fileName, + uri, + fileType, + expiresOn, + validationStatus, + validationFailureDetails, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The test run results file. + /// The test run report with metrics. + /// The container for test run artifacts. + /// The report file for the test run. + /// A new instance for mocking. + public static TestRunOutputArtifacts TestRunOutputArtifacts(TestRunFileInfo resultFileInfo = null, TestRunFileInfo logsFileInfo = null, ArtifactsContainerInfo artifactsContainerInfo = null, TestRunFileInfo reportFileInfo = null) + { + return new TestRunOutputArtifacts(resultFileInfo, logsFileInfo, artifactsContainerInfo, reportFileInfo, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// This is a SAS URI to an Azure Storage Container that contains the test run artifacts. + /// Expiry time of the container (RFC 3339 literal format). + /// A new instance for mocking. + public static ArtifactsContainerInfo ArtifactsContainerInfo(Uri uri = null, DateTimeOffset? expiresOn = null) + { + return new ArtifactsContainerInfo(uri, expiresOn, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + /// Test run identifier. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static TestRunAppComponents TestRunAppComponents(IDictionary components = null, string testRunId = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + components ??= new Dictionary(); + + return new TestRunAppComponents( + components, + testRunId, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Test run identifier. + /// + /// Azure resource metrics collection {metric id : metrics object} (Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + /// for metric id). + /// + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static TestRunServerMetricsConfiguration TestRunServerMetricsConfiguration(string testRunId = null, IDictionary metrics = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + metrics ??= new Dictionary(); + + return new TestRunServerMetricsConfiguration( + testRunId, + metrics, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// the values for the metric definitions. + /// A new instance for mocking. + public static MetricDefinitions MetricDefinitions(IEnumerable value = null) + { + value ??= new List(); + + return new MetricDefinitions(value?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of dimensions. + /// The metric description. + /// The metric name. + /// The namespace the metric belongs to. + /// The primary aggregation type value defining how to use the values for display. + /// The collection of what all aggregation types are supported. + /// The unit of the metric. + /// + /// Metric availability specifies the time grain (aggregation interval or + /// frequency). + /// + /// A new instance for mocking. + public static MetricDefinition MetricDefinition(IEnumerable dimensions = null, string description = null, string name = null, string @namespace = null, AggregationType? primaryAggregationType = null, IEnumerable supportedAggregationTypes = null, MetricUnit? unit = null, IEnumerable metricAvailabilities = null) + { + dimensions ??= new List(); + supportedAggregationTypes ??= new List(); + metricAvailabilities ??= new List(); + + return new MetricDefinition( + dimensions?.ToList(), + description, + name, + @namespace, + primaryAggregationType, + supportedAggregationTypes?.ToList(), + unit, + metricAvailabilities?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The description. + /// The name. + /// A new instance for mocking. + public static NameAndDescription NameAndDescription(string description = null, string name = null) + { + return new NameAndDescription(description, name, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The time grain specifies the aggregation interval for the metric. Expressed as + /// a duration 'PT1M', 'PT1H', etc. + /// + /// A new instance for mocking. + public static MetricAvailability MetricAvailability(TimeGrain? timeGrain = null) + { + return new MetricAvailability(timeGrain, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The values for the metric namespaces. + /// A new instance for mocking. + public static MetricNamespaces MetricNamespaces(IEnumerable value = null) + { + value ??= new List(); + + return new MetricNamespaces(value?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The namespace description. + /// The metric namespace name. + /// A new instance for mocking. + public static MetricNamespace MetricNamespace(string description = null, string name = null) + { + return new MetricNamespace(description, name, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// An array of data points representing the metric values. + /// The dimension values. + /// A new instance for mocking. + public static TimeSeriesElement TimeSeriesElement(IEnumerable data = null, IEnumerable dimensionValues = null) + { + data ??= new List(); + dimensionValues ??= new List(); + + return new TimeSeriesElement(data?.ToList(), dimensionValues?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The timestamp for the metric value in RFC 3339 format. + /// The metric value. + /// A new instance for mocking. + public static MetricValue MetricValue(DateTimeOffset? timestamp = null, double? value = null) + { + return new MetricValue(timestamp, value, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the dimension. + /// The value of the dimension. + /// A new instance for mocking. + public static DimensionValue DimensionValue(string name = null, string value = null) + { + return new DimensionValue(name, value, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Display name for the test profile run. + /// The test profile run description. + /// Associated test profile ID for the test profile run. This is required to create a test profile run and can't be updated. + /// Target resource ID on which the test profile run is created. + /// + /// Configurations of the target resource on which the test profile ran. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// The test profile run status. + /// Error details if there is any failure in test profile run. These errors are specific to the Test Profile Run. + /// The test profile run start DateTime(RFC 3339 literal format). + /// The test profile run end DateTime(RFC 3339 literal format). + /// Test profile run duration in seconds. + /// + /// Details of the test runs ran as part of the test profile run. + /// Key is the testRunId of the corresponding testRun. + /// + /// Recommendations provided based on a successful test profile run. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// A new instance for mocking. + public static TestProfileRun TestProfileRun(string testProfileRunId = null, string displayName = null, string description = null, string testProfileId = null, ResourceIdentifier targetResourceId = null, TargetResourceConfigurations targetResourceConfigurations = null, TestProfileRunStatus? status = null, IEnumerable errorDetails = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, long? durationInSeconds = null, IReadOnlyDictionary testRunDetails = null, IEnumerable recommendations = null, DateTimeOffset? createdDateTime = null, string createdBy = null, DateTimeOffset? lastModifiedDateTime = null, string lastModifiedBy = null) + { + errorDetails ??= new List(); + testRunDetails ??= new Dictionary(); + recommendations ??= new List(); + + return new TestProfileRun( + testProfileRunId, + displayName, + description, + testProfileId, + targetResourceId, + targetResourceConfigurations, + status, + errorDetails?.ToList(), + startDateTime, + endDateTime, + durationInSeconds, + testRunDetails, + recommendations?.ToList(), + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Status of the test run. + /// ID of the configuration on which the test ran. + /// Key value pair of extra properties associated with the test run. + /// A new instance for mocking. + public static TestRunDetail TestRunDetail(TestRunStatus status = default, string configurationId = null, IReadOnlyDictionary properties = null) + { + properties ??= new Dictionary(); + + return new TestRunDetail(status, configurationId, properties, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Category of the recommendation. + /// List of configurations IDs for which the recommendation is applicable. These are a subset of the provided target resource configurations. + /// A new instance for mocking. + public static TestProfileRunRecommendation TestProfileRunRecommendation(RecommendationCategory category = default, IEnumerable configurations = null) + { + configurations ??= new List(); + + return new TestProfileRunRecommendation(category, configurations?.ToList(), serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionFilter.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionFilter.Serialization.cs new file mode 100644 index 000000000000..08a6ff012082 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionFilter.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class DimensionFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DimensionFilter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DimensionFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DimensionFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDimensionFilter(document.RootElement, options); + } + + internal static DimensionFilter DeserializeDimensionFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IList values = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DimensionFilter(name, values ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DimensionFilter)} does not support writing '{options.Format}' format."); + } + } + + DimensionFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDimensionFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DimensionFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DimensionFilter FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDimensionFilter(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionFilter.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionFilter.cs new file mode 100644 index 000000000000..51ae24c5f29d --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionFilter.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Dimension name and values to filter. + public partial class DimensionFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DimensionFilter() + { + Values = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The dimension name. + /// The dimension values. Maximum values can be 20. + /// Keeps track of any properties unknown to the library. + internal DimensionFilter(string name, IList values, IDictionary serializedAdditionalRawData) + { + Name = name; + Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The dimension name. + public string Name { get; set; } + /// The dimension values. Maximum values can be 20. + public IList Values { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionValue.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionValue.Serialization.cs new file mode 100644 index 000000000000..a4d891c69967 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionValue.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class DimensionValue : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DimensionValue)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DimensionValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DimensionValue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDimensionValue(document.RootElement, options); + } + + internal static DimensionValue DeserializeDimensionValue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DimensionValue(name, value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DimensionValue)} does not support writing '{options.Format}' format."); + } + } + + DimensionValue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDimensionValue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DimensionValue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DimensionValue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDimensionValue(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionValue.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionValue.cs new file mode 100644 index 000000000000..84f36f89f44e --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/DimensionValue.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Represents a metric dimension value. + public partial class DimensionValue + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DimensionValue() + { + } + + /// Initializes a new instance of . + /// The name of the dimension. + /// The value of the dimension. + /// Keeps track of any properties unknown to the library. + internal DimensionValue(string name, string value, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the dimension. + public string Name { get; } + /// The value of the dimension. + public string Value { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Docs/LoadTestAdministrationClient.xml b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Docs/LoadTestAdministrationClient.xml new file mode 100644 index 000000000000..21a5080b9ff4 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Docs/LoadTestAdministrationClient.xml @@ -0,0 +1,871 @@ + + + + + +This sample shows how to call CreateOrUpdateTestAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + description = "sample description", + displayName = "Performance_LoadTest", + loadTestConfiguration = new + { + engineInstances = 6, + splitAllCSVs = true, + }, + passFailCriteria = new + { + passFailMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + clientMetric = "response_time_ms", + aggregate = "percentage", + condition = ">", + value = 20, + action = "continue", + } + }, + passFailServerMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + resourceId = "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + metricNamespace = "Microsoft.Compute/virtualMachines", + metricName = "Percentage CPU", + aggregation = "Average", + condition = ">", + value = 20, + action = "continue", + } + }, + }, + autoStopCriteria = new + { + autoStopDisabled = true, + errorRate = 70F, + errorRateTimeWindowInSeconds = 60, + }, + secrets = new + { + secret1 = new + { + value = "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + type = "AKV_SECRET_URI", + }, + }, + environmentVariables = new + { + envvar1 = "sampletext", + }, + subnetId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + keyvaultReferenceIdentityType = "UserAssigned", + keyvaultReferenceIdentityId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + metricsReferenceIdentityType = "UserAssigned", + metricsReferenceIdentityId = "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + engineBuiltInIdentityType = "UserAssigned", + engineBuiltInIdentityIds = new object[] + { + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + }, +}); +Response response = await client.CreateOrUpdateTestAsync("12345678-1234-1234-1234-123456789012", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testId").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateTest and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + description = "sample description", + displayName = "Performance_LoadTest", + loadTestConfiguration = new + { + engineInstances = 6, + splitAllCSVs = true, + }, + passFailCriteria = new + { + passFailMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + clientMetric = "response_time_ms", + aggregate = "percentage", + condition = ">", + value = 20, + action = "continue", + } + }, + passFailServerMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + resourceId = "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + metricNamespace = "Microsoft.Compute/virtualMachines", + metricName = "Percentage CPU", + aggregation = "Average", + condition = ">", + value = 20, + action = "continue", + } + }, + }, + autoStopCriteria = new + { + autoStopDisabled = true, + errorRate = 70F, + errorRateTimeWindowInSeconds = 60, + }, + secrets = new + { + secret1 = new + { + value = "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + type = "AKV_SECRET_URI", + }, + }, + environmentVariables = new + { + envvar1 = "sampletext", + }, + subnetId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + keyvaultReferenceIdentityType = "UserAssigned", + keyvaultReferenceIdentityId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + metricsReferenceIdentityType = "UserAssigned", + metricsReferenceIdentityId = "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + engineBuiltInIdentityType = "UserAssigned", + engineBuiltInIdentityIds = new object[] + { + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + }, +}); +Response response = client.CreateOrUpdateTest("12345678-1234-1234-1234-123456789012", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testId").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateAppComponentsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, +}); +Response response = await client.CreateOrUpdateAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateAppComponents and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, +}); +Response response = client.CreateOrUpdateAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateServerMetricsConfigAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, +}); +Response response = await client.CreateOrUpdateServerMetricsConfigAsync("edc6e529-d009-4b99-b763-ca492e3a2823", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateServerMetricsConfig and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, +}); +Response response = client.CreateOrUpdateServerMetricsConfig("edc6e529-d009-4b99-b763-ca492e3a2823", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call GetAppComponentsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); +]]> + + + +This sample shows how to call GetAppComponents. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); +]]> + + + +This sample shows how to call GetAppComponentsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call GetAppComponents and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call GetServerMetricsConfigAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetServerMetricsConfig. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetServerMetricsConfigAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call GetServerMetricsConfig and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); +Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call GetTestAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetTestAsync("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetTest. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetTest("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetTestAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetTestAsync("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testId").ToString()); +]]> + + + +This sample shows how to call GetTest and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetTest("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testId").ToString()); +]]> + + + +This sample shows how to call GetTestFileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetTestFileAsync("12345678-1234-1234-1234-123456789012", "sample.jmx"); +]]> + + + +This sample shows how to call GetTestFile. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetTestFile("12345678-1234-1234-1234-123456789012", "sample.jmx"); +]]> + + + +This sample shows how to call GetTestFileAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetTestFileAsync("12345678-1234-1234-1234-123456789012", "sample.jmx", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("fileName").ToString()); +]]> + + + +This sample shows how to call GetTestFile and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetTestFile("12345678-1234-1234-1234-123456789012", "sample.jmx", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("fileName").ToString()); +]]> + + + +This sample shows how to call DeleteTestFileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.DeleteTestFileAsync("12345678-1234-1234-1234-123456789012", "app.jmx"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteTestFile. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.DeleteTestFile("12345678-1234-1234-1234-123456789012", "app.jmx"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteTestAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.DeleteTestAsync("12345678-1234-1234-1234-123456789012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteTest. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.DeleteTest("12345678-1234-1234-1234-123456789012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CreateOrUpdateTestProfileAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + description = "sample description", + displayName = "Performance_TestProfile", + testId = "12346-abcd-6789", + targetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp", + targetResourceConfigurations = new + { + kind = "FunctionsFlexConsumption", + configurations = new + { + config1 = new + { + instanceMemoryMB = 2048L, + httpConcurrency = 16L, + }, + config2 = new + { + instanceMemoryMB = 4096L, + httpConcurrency = 16L, + }, + }, + }, +}); +Response response = await client.CreateOrUpdateTestProfileAsync("12345678-1234-1234-1234-123456789012", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileId").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateTestProfile and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + description = "sample description", + displayName = "Performance_TestProfile", + testId = "12346-abcd-6789", + targetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp", + targetResourceConfigurations = new + { + kind = "FunctionsFlexConsumption", + configurations = new + { + config1 = new + { + instanceMemoryMB = 2048L, + httpConcurrency = 16L, + }, + config2 = new + { + instanceMemoryMB = 4096L, + httpConcurrency = 16L, + }, + }, + }, +}); +Response response = client.CreateOrUpdateTestProfile("12345678-1234-1234-1234-123456789012", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileId").ToString()); +]]> + + + +This sample shows how to call DeleteTestProfileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.DeleteTestProfileAsync("12345678-1234-1234-1234-123456789012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteTestProfile. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.DeleteTestProfile("12345678-1234-1234-1234-123456789012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetTestProfileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetTestProfileAsync("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetTestProfile. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetTestProfile("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetTestProfileAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = await client.GetTestProfileAsync("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileId").ToString()); +]]> + + + +This sample shows how to call GetTestProfile and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +Response response = client.GetTestProfile("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileId").ToString()); +]]> + + + +This sample shows how to call GetTestFilesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +await foreach (TestFileInfo item in client.GetTestFilesAsync("12345678-1234-1234-1234-123456789012")) +{ +} +]]> + + + +This sample shows how to call GetTestFiles. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +foreach (TestFileInfo item in client.GetTestFiles("12345678-1234-1234-1234-123456789012")) +{ +} +]]> + + + +This sample shows how to call GetTestFilesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +await foreach (BinaryData item in client.GetTestFilesAsync("12345678-1234-1234-1234-123456789012", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); +} +]]> + + + +This sample shows how to call GetTestFiles and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +foreach (BinaryData item in client.GetTestFiles("12345678-1234-1234-1234-123456789012", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); +} +]]> + + + +This sample shows how to call GetTestsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +await foreach (LoadTest item in client.GetTestsAsync()) +{ +} +]]> + + + +This sample shows how to call GetTests. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +foreach (LoadTest item in client.GetTests()) +{ +} +]]> + + + +This sample shows how to call GetTestsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +await foreach (BinaryData item in client.GetTestsAsync(null, "Performance_LoadTest", null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); +} +]]> + + + +This sample shows how to call GetTests and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +foreach (BinaryData item in client.GetTests(null, "Performance_LoadTest", null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); +} +]]> + + + +This sample shows how to call GetTestProfilesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +await foreach (TestProfile item in client.GetTestProfilesAsync()) +{ +} +]]> + + + +This sample shows how to call GetTestProfiles. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +foreach (TestProfile item in client.GetTestProfiles()) +{ +} +]]> + + + +This sample shows how to call GetTestProfilesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +await foreach (BinaryData item in client.GetTestProfilesAsync(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); +} +]]> + + + +This sample shows how to call GetTestProfiles and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + +foreach (BinaryData item in client.GetTestProfiles(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Docs/LoadTestRunClient.xml b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Docs/LoadTestRunClient.xml new file mode 100644 index 000000000000..de5880f69a74 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Docs/LoadTestRunClient.xml @@ -0,0 +1,917 @@ + + + + + +This sample shows how to call CreateOrUpdateAppComponentsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, +}); +Response response = await client.CreateOrUpdateAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateAppComponents and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, +}); +Response response = client.CreateOrUpdateAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateServerMetricsConfigAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, +}); +Response response = await client.CreateOrUpdateServerMetricsConfigAsync("edc6e529-d009-4b99-b763-ca492e3a2823", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateServerMetricsConfig and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, +}); +Response response = client.CreateOrUpdateServerMetricsConfig("edc6e529-d009-4b99-b763-ca492e3a2823", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call DeleteTestRunAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.DeleteTestRunAsync("12316678-1234-1234-1234-122451189012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteTestRun. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.DeleteTestRun("12316678-1234-1234-1234-122451189012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetAppComponentsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); +]]> + + + +This sample shows how to call GetAppComponents. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); +]]> + + + +This sample shows how to call GetAppComponentsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call GetAppComponents and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); +Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); +]]> + + + +This sample shows how to call GetServerMetricsConfigAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetServerMetricsConfig. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012"); +]]> + + + +This sample shows how to call GetServerMetricsConfigAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call GetServerMetricsConfig and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call GetTestRunAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestRunAsync("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call GetTestRun. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestRun("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call GetTestRunAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestRunAsync("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testRunId").ToString()); +]]> + + + +This sample shows how to call GetTestRun and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestRun("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testRunId").ToString()); +]]> + + + +This sample shows how to call GetTestRunFileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestRunFileAsync("12316678-1234-1234-1234-122451189012", "sample.jmx"); +]]> + + + +This sample shows how to call GetTestRunFile. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestRunFile("12316678-1234-1234-1234-122451189012", "sample.jmx"); +]]> + + + +This sample shows how to call GetTestRunFileAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestRunFileAsync("12316678-1234-1234-1234-122451189012", "sample.jmx", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("fileName").ToString()); +]]> + + + +This sample shows how to call GetTestRunFile and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestRunFile("12316678-1234-1234-1234-122451189012", "sample.jmx", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("fileName").ToString()); +]]> + + + +This sample shows how to call GetMetricDefinitionsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetMetricDefinitionsAsync("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics"); +]]> + + + +This sample shows how to call GetMetricDefinitions. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetMetricDefinitions("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics"); +]]> + + + +This sample shows how to call GetMetricDefinitionsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetMetricDefinitionsAsync("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].ToString()); +]]> + + + +This sample shows how to call GetMetricDefinitions and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetMetricDefinitions("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].ToString()); +]]> + + + +This sample shows how to call GetMetricNamespacesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetMetricNamespacesAsync("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call GetMetricNamespaces. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetMetricNamespaces("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call GetMetricNamespacesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetMetricNamespacesAsync("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].ToString()); +]]> + + + +This sample shows how to call GetMetricNamespaces and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetMetricNamespaces("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].ToString()); +]]> + + + +This sample shows how to call StopTestRunAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.StopTestRunAsync("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call StopTestRun. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.StopTestRun("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call StopTestRunAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.StopTestRunAsync("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testRunId").ToString()); +]]> + + + +This sample shows how to call StopTestRun and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.StopTestRun("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testRunId").ToString()); +]]> + + + +This sample shows how to call DeleteTestProfileRunAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.DeleteTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteTestProfileRun. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.DeleteTestProfileRun("12316678-1234-1234-1234-122451189012"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetTestProfileRunAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); +]]> +This sample shows how to call GetTestProfileRunAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call GetTestProfileRun. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012"); +]]> +This sample shows how to call GetTestProfileRun. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call GetTestProfileRunAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +]]> +This sample shows how to call GetTestProfileRunAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +]]> + + + +This sample shows how to call GetTestProfileRun and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +]]> +This sample shows how to call GetTestProfileRun and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +]]> + + + +This sample shows how to call StopTestProfileRunAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.StopTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call StopTestProfileRun. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.StopTestProfileRun("12316678-1234-1234-1234-122451189012"); +]]> + + + +This sample shows how to call StopTestProfileRunAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = await client.StopTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +]]> + + + +This sample shows how to call StopTestProfileRun and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +Response response = client.StopTestProfileRun("12316678-1234-1234-1234-122451189012", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +]]> + + + +This sample shows how to call GetMetricDimensionValuesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +await foreach (string item in client.GetMetricDimensionValuesAsync("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) +{ +} +]]> + + + +This sample shows how to call GetMetricDimensionValues. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +foreach (string item in client.GetMetricDimensionValues("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) +{ +} +]]> + + + +This sample shows how to call GetMetricDimensionValuesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +await foreach (BinaryData item in client.GetMetricDimensionValuesAsync("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", "PT1H", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); +} +]]> + + + +This sample shows how to call GetMetricDimensionValues and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +foreach (BinaryData item in client.GetMetricDimensionValues("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", "PT1H", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); +} +]]> + + + +This sample shows how to call GetMetricsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +await foreach (TimeSeriesElement item in client.GetMetricsAsync("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) +{ +} +]]> + + + +This sample shows how to call GetMetrics. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +foreach (TimeSeriesElement item in client.GetMetrics("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) +{ +} +]]> + + + +This sample shows how to call GetMetricsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + filters = new object[] + { + new + { + name = "SamplerName", + values = new object[] + { + "HTTP Request" + }, + } + }, +}); +await foreach (BinaryData item in client.GetMetricsAsync("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", content)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); +} +]]> + + + +This sample shows how to call GetMetrics and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + filters = new object[] + { + new + { + name = "SamplerName", + values = new object[] + { + "HTTP Request" + }, + } + }, +}); +foreach (BinaryData item in client.GetMetrics("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", content)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); +} +]]> + + + +This sample shows how to call GetTestRunsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +await foreach (LoadTestRun item in client.GetTestRunsAsync()) +{ +} +]]> + + + +This sample shows how to call GetTestRuns. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +foreach (LoadTestRun item in client.GetTestRuns()) +{ +} +]]> + + + +This sample shows how to call GetTestRunsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +await foreach (BinaryData item in client.GetTestRunsAsync(null, "Performance_LoadTest_Run1", "12345678-1234-1234-1234-123456789012", DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), "DONE,EXECUTING", null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); +} +]]> + + + +This sample shows how to call GetTestRuns and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +foreach (BinaryData item in client.GetTestRuns(null, "Performance_LoadTest_Run1", "12345678-1234-1234-1234-123456789012", DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), "DONE,EXECUTING", null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); +} +]]> + + + +This sample shows how to call GetTestProfileRunsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +await foreach (TestProfileRun item in client.GetTestProfileRunsAsync()) +{ +} +]]> + + + +This sample shows how to call GetTestProfileRuns. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +foreach (TestProfileRun item in client.GetTestProfileRuns()) +{ +} +]]> + + + +This sample shows how to call GetTestProfileRunsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +await foreach (BinaryData item in client.GetTestProfileRunsAsync(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +} +]]> + + + +This sample shows how to call GetTestProfileRuns and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + +foreach (BinaryData item in client.GetTestProfileRuns(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ErrorDetails.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ErrorDetails.Serialization.cs new file mode 100644 index 000000000000..d2016b9b5ab4 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ErrorDetails.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class ErrorDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorDetails)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ErrorDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorDetails(document.RootElement, options); + } + + internal static ErrorDetails DeserializeErrorDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorDetails(message, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ErrorDetails)} does not support writing '{options.Format}' format."); + } + } + + ErrorDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeErrorDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ErrorDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeErrorDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ErrorDetails.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ErrorDetails.cs new file mode 100644 index 000000000000..42c16951cb7c --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ErrorDetails.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Error details if there is any failure in load test run. + public partial class ErrorDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ErrorDetails() + { + } + + /// Initializes a new instance of . + /// Error details in case test run was not successfully run. + /// Keeps track of any properties unknown to the library. + internal ErrorDetails(string message, IDictionary serializedAdditionalRawData) + { + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Error details in case test run was not successfully run. + public string Message { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FileValidationStatus.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FileValidationStatus.cs new file mode 100644 index 000000000000..93393256bc43 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FileValidationStatus.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// File status. + public readonly partial struct FileValidationStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FileValidationStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotValidatedValue = "NOT_VALIDATED"; + private const string ValidationSuccessValue = "VALIDATION_SUCCESS"; + private const string ValidationFailureValue = "VALIDATION_FAILURE"; + private const string ValidationInitiatedValue = "VALIDATION_INITIATED"; + private const string ValidationNotRequiredValue = "VALIDATION_NOT_REQUIRED"; + + /// File is not validated. + public static FileValidationStatus NotValidated { get; } = new FileValidationStatus(NotValidatedValue); + /// File is validated. + public static FileValidationStatus ValidationSuccess { get; } = new FileValidationStatus(ValidationSuccessValue); + /// File validation is failed. + public static FileValidationStatus ValidationFailure { get; } = new FileValidationStatus(ValidationFailureValue); + /// File validation is in progress. + public static FileValidationStatus ValidationInitiated { get; } = new FileValidationStatus(ValidationInitiatedValue); + /// Validation is not required. + public static FileValidationStatus ValidationNotRequired { get; } = new FileValidationStatus(ValidationNotRequiredValue); + /// Determines if two values are the same. + public static bool operator ==(FileValidationStatus left, FileValidationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FileValidationStatus left, FileValidationStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FileValidationStatus(string value) => new FileValidationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FileValidationStatus other && Equals(other); + /// + public bool Equals(FileValidationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionResourceConfiguration.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionResourceConfiguration.Serialization.cs new file mode 100644 index 000000000000..70955cafaa59 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionResourceConfiguration.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class FunctionFlexConsumptionResourceConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionFlexConsumptionResourceConfiguration)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("instanceMemoryMB"u8); + writer.WriteNumberValue(InstanceMemoryMB); + if (Optional.IsDefined(HttpConcurrency)) + { + writer.WritePropertyName("httpConcurrency"u8); + writer.WriteNumberValue(HttpConcurrency.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FunctionFlexConsumptionResourceConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionFlexConsumptionResourceConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionFlexConsumptionResourceConfiguration(document.RootElement, options); + } + + internal static FunctionFlexConsumptionResourceConfiguration DeserializeFunctionFlexConsumptionResourceConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long instanceMemoryMB = default; + long? httpConcurrency = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceMemoryMB"u8)) + { + instanceMemoryMB = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("httpConcurrency"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpConcurrency = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionFlexConsumptionResourceConfiguration(instanceMemoryMB, httpConcurrency, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FunctionFlexConsumptionResourceConfiguration)} does not support writing '{options.Format}' format."); + } + } + + FunctionFlexConsumptionResourceConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionFlexConsumptionResourceConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionFlexConsumptionResourceConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FunctionFlexConsumptionResourceConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionFlexConsumptionResourceConfiguration(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionResourceConfiguration.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionResourceConfiguration.cs new file mode 100644 index 000000000000..78c4e07ce0de --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionResourceConfiguration.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Resource configuration instance for a Flex Consumption based Azure Function App. + public partial class FunctionFlexConsumptionResourceConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Memory size of the instance. Supported values are 2048, 4096. + public FunctionFlexConsumptionResourceConfiguration(long instanceMemoryMB) + { + InstanceMemoryMB = instanceMemoryMB; + } + + /// Initializes a new instance of . + /// Memory size of the instance. Supported values are 2048, 4096. + /// HTTP Concurrency for the function app. + /// Keeps track of any properties unknown to the library. + internal FunctionFlexConsumptionResourceConfiguration(long instanceMemoryMB, long? httpConcurrency, IDictionary serializedAdditionalRawData) + { + InstanceMemoryMB = instanceMemoryMB; + HttpConcurrency = httpConcurrency; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FunctionFlexConsumptionResourceConfiguration() + { + } + + /// Memory size of the instance. Supported values are 2048, 4096. + public long InstanceMemoryMB { get; set; } + /// HTTP Concurrency for the function app. + public long? HttpConcurrency { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionTargetResourceConfigurations.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionTargetResourceConfigurations.Serialization.cs new file mode 100644 index 000000000000..090bcda9c39f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionTargetResourceConfigurations.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class FunctionFlexConsumptionTargetResourceConfigurations : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionFlexConsumptionTargetResourceConfigurations)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Configurations)) + { + writer.WritePropertyName("configurations"u8); + writer.WriteStartObject(); + foreach (var item in Configurations) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + } + + FunctionFlexConsumptionTargetResourceConfigurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionFlexConsumptionTargetResourceConfigurations)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionFlexConsumptionTargetResourceConfigurations(document.RootElement, options); + } + + internal static FunctionFlexConsumptionTargetResourceConfigurations DeserializeFunctionFlexConsumptionTargetResourceConfigurations(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary configurations = default; + ResourceKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, FunctionFlexConsumptionResourceConfiguration.DeserializeFunctionFlexConsumptionResourceConfiguration(property0.Value, options)); + } + configurations = dictionary; + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new ResourceKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionFlexConsumptionTargetResourceConfigurations(kind, serializedAdditionalRawData, configurations ?? new ChangeTrackingDictionary()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FunctionFlexConsumptionTargetResourceConfigurations)} does not support writing '{options.Format}' format."); + } + } + + FunctionFlexConsumptionTargetResourceConfigurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionFlexConsumptionTargetResourceConfigurations(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionFlexConsumptionTargetResourceConfigurations)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new FunctionFlexConsumptionTargetResourceConfigurations FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFunctionFlexConsumptionTargetResourceConfigurations(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionTargetResourceConfigurations.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionTargetResourceConfigurations.cs new file mode 100644 index 000000000000..3325be60e099 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/FunctionFlexConsumptionTargetResourceConfigurations.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Configurations for a Function App using Flex Consumption Plan. + public partial class FunctionFlexConsumptionTargetResourceConfigurations : TargetResourceConfigurations + { + /// Initializes a new instance of . + public FunctionFlexConsumptionTargetResourceConfigurations() + { + Kind = ResourceKind.FunctionsFlexConsumption; + Configurations = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Kind of the resource for which the configurations apply. + /// Keeps track of any properties unknown to the library. + /// A map of configurations for a Function app using Flex Consumption Plan. + internal FunctionFlexConsumptionTargetResourceConfigurations(ResourceKind kind, IDictionary serializedAdditionalRawData, IDictionary configurations) : base(kind, serializedAdditionalRawData) + { + Configurations = configurations; + } + + /// A map of configurations for a Function app using Flex Consumption Plan. + public IDictionary Configurations { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Argument.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..946929b236ff --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..9a5316eba10d --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ChangeTrackingList.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..5de833439355 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Developer.LoadTesting +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..f72f1fe51168 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Optional.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..248e10182762 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Developer.LoadTesting +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..5130928c6e0b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTest.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTest.Serialization.cs new file mode 100644 index 000000000000..50a4e9760e37 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTest.Serialization.cs @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class LoadTest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTest)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(PassFailCriteria)) + { + writer.WritePropertyName("passFailCriteria"u8); + writer.WriteObjectValue(PassFailCriteria, options); + } + if (Optional.IsDefined(AutoStopCriteria)) + { + writer.WritePropertyName("autoStopCriteria"u8); + writer.WriteObjectValue(AutoStopCriteria, options); + } + if (Optional.IsCollectionDefined(Secrets)) + { + writer.WritePropertyName("secrets"u8); + writer.WriteStartObject(); + foreach (var item in Secrets) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Certificate)) + { + writer.WritePropertyName("certificate"u8); + writer.WriteObjectValue(Certificate, options); + } + if (Optional.IsCollectionDefined(EnvironmentVariables)) + { + writer.WritePropertyName("environmentVariables"u8); + writer.WriteStartObject(); + foreach (var item in EnvironmentVariables) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(LoadTestConfiguration)) + { + writer.WritePropertyName("loadTestConfiguration"u8); + writer.WriteObjectValue(LoadTestConfiguration, options); + } + if (Optional.IsDefined(BaselineTestRunId)) + { + writer.WritePropertyName("baselineTestRunId"u8); + writer.WriteStringValue(BaselineTestRunId); + } + if (options.Format != "W" && Optional.IsDefined(InputArtifacts)) + { + writer.WritePropertyName("inputArtifacts"u8); + writer.WriteObjectValue(InputArtifacts, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("testId"u8); + writer.WriteStringValue(TestId); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(PublicIpDisabled)) + { + writer.WritePropertyName("publicIPDisabled"u8); + writer.WriteBooleanValue(PublicIpDisabled.Value); + } + if (Optional.IsDefined(KeyvaultReferenceIdentityType)) + { + writer.WritePropertyName("keyvaultReferenceIdentityType"u8); + writer.WriteStringValue(KeyvaultReferenceIdentityType); + } + if (Optional.IsDefined(KeyvaultReferenceIdentityId)) + { + writer.WritePropertyName("keyvaultReferenceIdentityId"u8); + writer.WriteStringValue(KeyvaultReferenceIdentityId); + } + if (Optional.IsDefined(MetricsReferenceIdentityType)) + { + writer.WritePropertyName("metricsReferenceIdentityType"u8); + writer.WriteStringValue(MetricsReferenceIdentityType.Value.ToString()); + } + if (Optional.IsDefined(MetricsReferenceIdentityId)) + { + writer.WritePropertyName("metricsReferenceIdentityId"u8); + writer.WriteStringValue(MetricsReferenceIdentityId); + } + if (Optional.IsDefined(EngineBuiltInIdentityType)) + { + writer.WritePropertyName("engineBuiltInIdentityType"u8); + writer.WriteStringValue(EngineBuiltInIdentityType.Value.ToString()); + } + if (Optional.IsCollectionDefined(EngineBuiltInIdentityIds)) + { + writer.WritePropertyName("engineBuiltInIdentityIds"u8); + writer.WriteStartArray(); + foreach (var item in EngineBuiltInIdentityIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LoadTest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLoadTest(document.RootElement, options); + } + + internal static LoadTest DeserializeLoadTest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PassFailCriteria passFailCriteria = default; + AutoStopCriteria autoStopCriteria = default; + IDictionary secrets = default; + TestCertificate certificate = default; + IDictionary environmentVariables = default; + LoadTestConfiguration loadTestConfiguration = default; + string baselineTestRunId = default; + TestInputArtifacts inputArtifacts = default; + string testId = default; + string description = default; + string displayName = default; + string subnetId = default; + LoadTestKind? kind = default; + bool? publicIPDisabled = default; + string keyvaultReferenceIdentityType = default; + string keyvaultReferenceIdentityId = default; + LoadTestingManagedIdentityType? metricsReferenceIdentityType = default; + string metricsReferenceIdentityId = default; + LoadTestingManagedIdentityType? engineBuiltInIdentityType = default; + IList engineBuiltInIdentityIds = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("passFailCriteria"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + passFailCriteria = PassFailCriteria.DeserializePassFailCriteria(property.Value, options); + continue; + } + if (property.NameEquals("autoStopCriteria"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoStopCriteria = AutoStopCriteria.DeserializeAutoStopCriteria(property.Value, options); + continue; + } + if (property.NameEquals("secrets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, TestSecret.DeserializeTestSecret(property0.Value, options)); + } + secrets = dictionary; + continue; + } + if (property.NameEquals("certificate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificate = TestCertificate.DeserializeTestCertificate(property.Value, options); + continue; + } + if (property.NameEquals("environmentVariables"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + environmentVariables = dictionary; + continue; + } + if (property.NameEquals("loadTestConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loadTestConfiguration = LoadTestConfiguration.DeserializeLoadTestConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("baselineTestRunId"u8)) + { + baselineTestRunId = property.Value.GetString(); + continue; + } + if (property.NameEquals("inputArtifacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + inputArtifacts = TestInputArtifacts.DeserializeTestInputArtifacts(property.Value, options); + continue; + } + if (property.NameEquals("testId"u8)) + { + testId = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("subnetId"u8)) + { + subnetId = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new LoadTestKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("publicIPDisabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicIPDisabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("keyvaultReferenceIdentityType"u8)) + { + keyvaultReferenceIdentityType = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyvaultReferenceIdentityId"u8)) + { + keyvaultReferenceIdentityId = property.Value.GetString(); + continue; + } + if (property.NameEquals("metricsReferenceIdentityType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metricsReferenceIdentityType = new LoadTestingManagedIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("metricsReferenceIdentityId"u8)) + { + metricsReferenceIdentityId = property.Value.GetString(); + continue; + } + if (property.NameEquals("engineBuiltInIdentityType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + engineBuiltInIdentityType = new LoadTestingManagedIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("engineBuiltInIdentityIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + engineBuiltInIdentityIds = array; + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LoadTest( + passFailCriteria, + autoStopCriteria, + secrets ?? new ChangeTrackingDictionary(), + certificate, + environmentVariables ?? new ChangeTrackingDictionary(), + loadTestConfiguration, + baselineTestRunId, + inputArtifacts, + testId, + description, + displayName, + subnetId, + kind, + publicIPDisabled, + keyvaultReferenceIdentityType, + keyvaultReferenceIdentityId, + metricsReferenceIdentityType, + metricsReferenceIdentityId, + engineBuiltInIdentityType, + engineBuiltInIdentityIds ?? new ChangeTrackingList(), + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LoadTest)} does not support writing '{options.Format}' format."); + } + } + + LoadTest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LoadTest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LoadTest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTest.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTest.cs new file mode 100644 index 000000000000..952f3a416ebc --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTest.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Load test model. + public partial class LoadTest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LoadTest() + { + Secrets = new ChangeTrackingDictionary(); + EnvironmentVariables = new ChangeTrackingDictionary(); + EngineBuiltInIdentityIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Pass fail criteria for a test. + /// Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. + /// + /// Secrets can be stored in an Azure Key Vault or any other secret store. If the + /// secret is stored in an Azure Key Vault, the value should be the secret + /// identifier and the type should be AKV_SECRET_URI. If the secret is stored + /// elsewhere, the secret value should be provided directly and the type should be + /// SECRET_VALUE. + /// + /// Certificates metadata. + /// Environment variables which are defined as a set of <name,value> pairs. + /// The load test configuration. + /// Id of the test run to be marked as baseline to view trends of client-side metrics from recent test runs. + /// The input artifacts for the test. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The test description. + /// Display name of a test. + /// Subnet ID on which the load test instances should run. + /// Kind of test. + /// Inject load test engines without deploying public IP for outbound access. + /// Type of the managed identity referencing the Key vault. + /// Resource Id of the managed identity referencing the Key vault. + /// Type of the managed identity referencing the metrics. + /// Resource Id of the managed identity referencing the metrics. + /// Type of the managed identity built in load test engines. + /// Resource Ids of the managed identity built in to load test engines. Required if engineBuiltInIdentityType is UserAssigned. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal LoadTest(PassFailCriteria passFailCriteria, AutoStopCriteria autoStopCriteria, IDictionary secrets, TestCertificate certificate, IDictionary environmentVariables, LoadTestConfiguration loadTestConfiguration, string baselineTestRunId, TestInputArtifacts inputArtifacts, string testId, string description, string displayName, string subnetId, LoadTestKind? kind, bool? publicIpDisabled, string keyvaultReferenceIdentityType, string keyvaultReferenceIdentityId, LoadTestingManagedIdentityType? metricsReferenceIdentityType, string metricsReferenceIdentityId, LoadTestingManagedIdentityType? engineBuiltInIdentityType, IList engineBuiltInIdentityIds, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + PassFailCriteria = passFailCriteria; + AutoStopCriteria = autoStopCriteria; + Secrets = secrets; + Certificate = certificate; + EnvironmentVariables = environmentVariables; + LoadTestConfiguration = loadTestConfiguration; + BaselineTestRunId = baselineTestRunId; + InputArtifacts = inputArtifacts; + TestId = testId; + Description = description; + DisplayName = displayName; + SubnetId = subnetId; + Kind = kind; + PublicIpDisabled = publicIpDisabled; + KeyvaultReferenceIdentityType = keyvaultReferenceIdentityType; + KeyvaultReferenceIdentityId = keyvaultReferenceIdentityId; + MetricsReferenceIdentityType = metricsReferenceIdentityType; + MetricsReferenceIdentityId = metricsReferenceIdentityId; + EngineBuiltInIdentityType = engineBuiltInIdentityType; + EngineBuiltInIdentityIds = engineBuiltInIdentityIds; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Pass fail criteria for a test. + public PassFailCriteria PassFailCriteria { get; set; } + /// Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. + public AutoStopCriteria AutoStopCriteria { get; set; } + /// + /// Secrets can be stored in an Azure Key Vault or any other secret store. If the + /// secret is stored in an Azure Key Vault, the value should be the secret + /// identifier and the type should be AKV_SECRET_URI. If the secret is stored + /// elsewhere, the secret value should be provided directly and the type should be + /// SECRET_VALUE. + /// + public IDictionary Secrets { get; } + /// Certificates metadata. + public TestCertificate Certificate { get; set; } + /// Environment variables which are defined as a set of <name,value> pairs. + public IDictionary EnvironmentVariables { get; } + /// The load test configuration. + public LoadTestConfiguration LoadTestConfiguration { get; set; } + /// Id of the test run to be marked as baseline to view trends of client-side metrics from recent test runs. + public string BaselineTestRunId { get; set; } + /// The input artifacts for the test. + public TestInputArtifacts InputArtifacts { get; } + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + public string TestId { get; } + /// The test description. + public string Description { get; set; } + /// Display name of a test. + public string DisplayName { get; set; } + /// Subnet ID on which the load test instances should run. + public string SubnetId { get; set; } + /// Kind of test. + public LoadTestKind? Kind { get; set; } + /// Inject load test engines without deploying public IP for outbound access. + public bool? PublicIpDisabled { get; set; } + /// Type of the managed identity referencing the Key vault. + public string KeyvaultReferenceIdentityType { get; set; } + /// Resource Id of the managed identity referencing the Key vault. + public string KeyvaultReferenceIdentityId { get; set; } + /// Type of the managed identity referencing the metrics. + public LoadTestingManagedIdentityType? MetricsReferenceIdentityType { get; set; } + /// Resource Id of the managed identity referencing the metrics. + public string MetricsReferenceIdentityId { get; set; } + /// Type of the managed identity built in load test engines. + public LoadTestingManagedIdentityType? EngineBuiltInIdentityType { get; set; } + /// Resource Ids of the managed identity built in to load test engines. Required if engineBuiltInIdentityType is UserAssigned. + public IList EngineBuiltInIdentityIds { get; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestAdministrationClient.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestAdministrationClient.cs new file mode 100644 index 000000000000..1504a083a0a0 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestAdministrationClient.cs @@ -0,0 +1,2030 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Developer.LoadTesting +{ + // Data plane generated client. + /// The LoadTestAdministration service client. + public partial class LoadTestAdministrationClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://cnt-prod.loadtesting.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of LoadTestAdministrationClient for mocking. + protected LoadTestAdministrationClient() + { + } + + /// Initializes a new instance of LoadTestAdministrationClient. + /// The to use. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public LoadTestAdministrationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AzureDeveloperLoadTestingClientOptions()) + { + } + + /// Initializes a new instance of LoadTestAdministrationClient. + /// The to use. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public LoadTestAdministrationClient(Uri endpoint, TokenCredential credential, AzureDeveloperLoadTestingClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AzureDeveloperLoadTestingClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Create a new test or update an existing test by providing the test Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrUpdateTestAsync(string testId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateTest"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestRequest(testId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a new test or update an existing test by providing the test Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrUpdateTest(string testId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateTest"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestRequest(testId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Add an app component to a test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrUpdateAppComponentsAsync(string testId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateAppComponentsRequest(testId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Add an app component to a test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrUpdateAppComponents(string testId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateAppComponentsRequest(testId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Configure server metrics for a test + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrUpdateServerMetricsConfigAsync(string testId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateServerMetricsConfigRequest(testId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Configure server metrics for a test + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrUpdateServerMetricsConfig(string testId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateServerMetricsConfigRequest(testId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get associated app component (collection of azure resources) for the given test. + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetAppComponentsAsync(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAppComponentsAsync(testId, context).ConfigureAwait(false); + return Response.FromValue(TestAppComponents.FromResponse(response), response); + } + + /// Get associated app component (collection of azure resources) for the given test. + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetAppComponents(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAppComponents(testId, context); + return Response.FromValue(TestAppComponents.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get associated app component (collection of azure resources) for the given test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetAppComponentsAsync(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAppComponentsRequest(testId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get associated app component (collection of azure resources) for the given test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetAppComponents(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAppComponentsRequest(testId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List server metrics configuration for the given test. + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetServerMetricsConfigAsync(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetServerMetricsConfigAsync(testId, context).ConfigureAwait(false); + return Response.FromValue(TestServerMetricsConfiguration.FromResponse(response), response); + } + + /// List server metrics configuration for the given test. + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetServerMetricsConfig(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetServerMetricsConfig(testId, context); + return Response.FromValue(TestServerMetricsConfiguration.FromResponse(response), response); + } + + /// + /// [Protocol Method] List server metrics configuration for the given test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetServerMetricsConfigAsync(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateGetServerMetricsConfigRequest(testId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] List server metrics configuration for the given test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetServerMetricsConfig(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateGetServerMetricsConfigRequest(testId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get load test details by test Id. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetTestAsync(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetTestAsync(testId, context).ConfigureAwait(false); + return Response.FromValue(LoadTest.FromResponse(response), response); + } + + /// Get load test details by test Id. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetTest(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetTest(testId, context); + return Response.FromValue(LoadTest.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get load test details by test Id + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetTestAsync(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetTest"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestRequest(testId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get load test details by test Id + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetTest(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetTest"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestRequest(testId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get all the files that are associated with a test. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetTestFileAsync(string testId, string fileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetTestFileAsync(testId, fileName, context).ConfigureAwait(false); + return Response.FromValue(TestFileInfo.FromResponse(response), response); + } + + /// Get all the files that are associated with a test. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetTestFile(string testId, string fileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetTestFile(testId, fileName, context); + return Response.FromValue(TestFileInfo.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get all the files that are associated with a test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetTestFileAsync(string testId, string fileName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetTestFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestFileRequest(testId, fileName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get all the files that are associated with a test. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetTestFile(string testId, string fileName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetTestFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestFileRequest(testId, fileName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Upload input file for a given test Id. File size can't be more than 50 MB. + /// Existing file with same name for the given test will be overwritten. File + /// should be provided in the request body as application/octet-stream. + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Unique name for test file with file extension like : App.jmx. + /// The file content as application/octet-stream. + /// File type. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + internal virtual async Task> UploadTestFileAsync(string testId, string fileName, BinaryData body, LoadTestingFileType? fileType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body; + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UploadTestFileAsync(testId, fileName, content, fileType?.ToString(), context).ConfigureAwait(false); + return Response.FromValue(TestFileInfo.FromResponse(response), response); + } + + /// + /// Upload input file for a given test Id. File size can't be more than 50 MB. + /// Existing file with same name for the given test will be overwritten. File + /// should be provided in the request body as application/octet-stream. + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Unique name for test file with file extension like : App.jmx. + /// The file content as application/octet-stream. + /// File type. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + internal virtual Response UploadTestFile(string testId, string fileName, BinaryData body, LoadTestingFileType? fileType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body; + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UploadTestFile(testId, fileName, content, fileType?.ToString(), context); + return Response.FromValue(TestFileInfo.FromResponse(response), response); + } + + /// + /// [Protocol Method] Upload input file for a given test Id. File size can't be more than 50 MB. + /// Existing file with same name for the given test will be overwritten. File + /// should be provided in the request body as application/octet-stream. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Unique name for test file with file extension like : App.jmx. + /// The content to send as the body of the request. + /// File type. Allowed values: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS" | "ZIPPED_ARTIFACTS" | "URL_TEST_CONFIG" | "TEST_SCRIPT". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task UploadTestFileAsync(string testId, string fileName, RequestContent content, string fileType = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.UploadTestFile"); + scope.Start(); + try + { + using HttpMessage message = CreateUploadTestFileRequest(testId, fileName, content, fileType, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Upload input file for a given test Id. File size can't be more than 50 MB. + /// Existing file with same name for the given test will be overwritten. File + /// should be provided in the request body as application/octet-stream. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Unique name for test file with file extension like : App.jmx. + /// The content to send as the body of the request. + /// File type. Allowed values: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS" | "ZIPPED_ARTIFACTS" | "URL_TEST_CONFIG" | "TEST_SCRIPT". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response UploadTestFile(string testId, string fileName, RequestContent content, string fileType = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.UploadTestFile"); + scope.Start(); + try + { + using HttpMessage message = CreateUploadTestFileRequest(testId, fileName, content, fileType, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete file by the file name for a test + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteTestFileAsync(string testId, string fileName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.DeleteTestFile"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestFileRequest(testId, fileName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete file by the file name for a test + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteTestFile(string testId, string fileName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.DeleteTestFile"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestFileRequest(testId, fileName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a test by its test Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteTestAsync(string testId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.DeleteTest"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestRequest(testId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a test by its test Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteTest(string testId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.DeleteTest"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestRequest(testId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a new test profile or update an existing test profile. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrUpdateTestProfileAsync(string testProfileId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateTestProfile"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestProfileRequest(testProfileId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a new test profile or update an existing test profile. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrUpdateTestProfile(string testProfileId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.CreateOrUpdateTestProfile"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestProfileRequest(testProfileId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a test profile. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteTestProfileAsync(string testProfileId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.DeleteTestProfile"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestProfileRequest(testProfileId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a test profile. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteTestProfile(string testProfileId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.DeleteTestProfile"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestProfileRequest(testProfileId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get load test profile details. + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Get load test profile details by test profile Id. + /// + public virtual async Task> GetTestProfileAsync(string testProfileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetTestProfileAsync(testProfileId, context).ConfigureAwait(false); + return Response.FromValue(TestProfile.FromResponse(response), response); + } + + /// Get load test profile details. + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Get load test profile details by test profile Id. + /// + public virtual Response GetTestProfile(string testProfileId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetTestProfile(testProfileId, context); + return Response.FromValue(TestProfile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get load test profile details. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetTestProfileAsync(string testProfileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetTestProfile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestProfileRequest(testProfileId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get load test profile details. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetTestProfile(string testProfileId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testProfileId, nameof(testProfileId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestAdministrationClient.GetTestProfile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestProfileRequest(testProfileId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get all test files. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetTestFilesAsync(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestFilesRequest(testId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestFilesNextPageRequest(nextLink, testId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => TestFileInfo.DeserializeTestFileInfo(e), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestFiles", "value", "nextLink", context); + } + + /// Get all test files. + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetTestFiles(string testId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestFilesRequest(testId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestFilesNextPageRequest(nextLink, testId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => TestFileInfo.DeserializeTestFileInfo(e), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestFiles", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Get all test files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetTestFilesAsync(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestFilesRequest(testId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestFilesNextPageRequest(nextLink, testId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestFiles", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Get all test files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetTestFiles(string testId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testId, nameof(testId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestFilesRequest(testId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestFilesNextPageRequest(nextLink, testId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestFiles", "value", "nextLink", context); + } + + /// + /// Get all load tests by the fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + /// + /// + /// Sort on the supported fields in (field asc/desc) format. eg: + /// lastModifiedDateTime asc. Supported fields - lastModifiedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - displayName, + /// createdBy. For example, to search for a test, with display name is Login Test, + /// the search parameter can be Login. + /// + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// Number of results in response. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetTestsAsync(string orderby = null, string search = null, DateTimeOffset? lastModifiedStartTime = null, DateTimeOffset? lastModifiedEndTime = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestsRequest(orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestsNextPageRequest(nextLink, orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => LoadTest.DeserializeLoadTest(e), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTests", "value", "nextLink", maxpagesize, context); + } + + /// + /// Get all load tests by the fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + /// + /// + /// Sort on the supported fields in (field asc/desc) format. eg: + /// lastModifiedDateTime asc. Supported fields - lastModifiedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - displayName, + /// createdBy. For example, to search for a test, with display name is Login Test, + /// the search parameter can be Login. + /// + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// Number of results in response. + /// The cancellation token to use. + /// + public virtual Pageable GetTests(string orderby = null, string search = null, DateTimeOffset? lastModifiedStartTime = null, DateTimeOffset? lastModifiedEndTime = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestsRequest(orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestsNextPageRequest(nextLink, orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => LoadTest.DeserializeLoadTest(e), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTests", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] Get all load tests by the fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Sort on the supported fields in (field asc/desc) format. eg: + /// lastModifiedDateTime asc. Supported fields - lastModifiedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - displayName, + /// createdBy. For example, to search for a test, with display name is Login Test, + /// the search parameter can be Login. + /// + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// Number of results in response. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetTestsAsync(string orderby, string search, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestsRequest(orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestsNextPageRequest(nextLink, orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTests", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] Get all load tests by the fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Sort on the supported fields in (field asc/desc) format. eg: + /// lastModifiedDateTime asc. Supported fields - lastModifiedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - displayName, + /// createdBy. For example, to search for a test, with display name is Login Test, + /// the search parameter can be Login. + /// + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + /// Number of results in response. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetTests(string orderby, string search, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestsRequest(orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestsNextPageRequest(nextLink, orderby, search, lastModifiedStartTime, lastModifiedEndTime, pageSizeHint, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTests", "value", "nextLink", maxpagesize, context); + } + + /// List test profiles. + /// Maximum number of results to include in a single response. + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// Comma separated list of IDs of the test profiles to filter. + /// Comma separated list IDs of the tests which should be associated with the test profiles to fetch. + /// The cancellation token to use. + /// Get all test profiles for the given filters. + /// + public virtual AsyncPageable GetTestProfilesAsync(int? maxpagesize = null, DateTimeOffset? lastModifiedStartTime = null, DateTimeOffset? lastModifiedEndTime = null, IEnumerable testProfileIds = null, IEnumerable testIds = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfilesRequest(pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfilesNextPageRequest(nextLink, pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => TestProfile.DeserializeTestProfile(e), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestProfiles", "value", "nextLink", maxpagesize, context); + } + + /// List test profiles. + /// Maximum number of results to include in a single response. + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// Comma separated list of IDs of the test profiles to filter. + /// Comma separated list IDs of the tests which should be associated with the test profiles to fetch. + /// The cancellation token to use. + /// Get all test profiles for the given filters. + /// + public virtual Pageable GetTestProfiles(int? maxpagesize = null, DateTimeOffset? lastModifiedStartTime = null, DateTimeOffset? lastModifiedEndTime = null, IEnumerable testProfileIds = null, IEnumerable testIds = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfilesRequest(pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfilesNextPageRequest(nextLink, pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => TestProfile.DeserializeTestProfile(e), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestProfiles", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] List test profiles. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Maximum number of results to include in a single response. + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// Comma separated list of IDs of the test profiles to filter. + /// Comma separated list IDs of the tests which should be associated with the test profiles to fetch. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetTestProfilesAsync(int? maxpagesize, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, IEnumerable testProfileIds, IEnumerable testIds, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfilesRequest(pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfilesNextPageRequest(nextLink, pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestProfiles", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] List test profiles. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Maximum number of results to include in a single response. + /// Start DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// End DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. + /// Comma separated list of IDs of the test profiles to filter. + /// Comma separated list IDs of the tests which should be associated with the test profiles to fetch. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetTestProfiles(int? maxpagesize, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, IEnumerable testProfileIds, IEnumerable testIds, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfilesRequest(pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfilesNextPageRequest(nextLink, pageSizeHint, lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestAdministrationClient.GetTestProfiles", "value", "nextLink", maxpagesize, context); + } + + internal HttpMessage CreateCreateOrUpdateTestRequest(string testId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCreateOrUpdateAppComponentsRequest(string testId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/app-components", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCreateOrUpdateServerMetricsConfigRequest(string testId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/server-metrics-config", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetAppComponentsRequest(string testId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/app-components", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetServerMetricsConfigRequest(string testId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/server-metrics-config", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestRequest(string testId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestFileRequest(string testId, string fileName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/files/", false); + uri.AppendPath(fileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestFilesRequest(string testId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/files", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestsRequest(string orderby, string search, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (orderby != null) + { + uri.AppendQuery("orderby", orderby, true); + } + if (search != null) + { + uri.AppendQuery("search", search, true); + } + if (lastModifiedStartTime != null) + { + uri.AppendQuery("lastModifiedStartTime", lastModifiedStartTime.Value, "O", true); + } + if (lastModifiedEndTime != null) + { + uri.AppendQuery("lastModifiedEndTime", lastModifiedEndTime.Value, "O", true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUploadTestFileRequest(string testId, string fileName, RequestContent content, string fileType, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier201); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/files/", false); + uri.AppendPath(fileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (fileType != null) + { + uri.AppendQuery("fileType", fileType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/octet-stream"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteTestFileRequest(string testId, string fileName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendPath("/files/", false); + uri.AppendPath(fileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteTestRequest(string testId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/tests/", false); + uri.AppendPath(testId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateTestProfileRequest(string testProfileId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profiles/", false); + uri.AppendPath(testProfileId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteTestProfileRequest(string testProfileId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profiles/", false); + uri.AppendPath(testProfileId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestProfileRequest(string testProfileId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profiles/", false); + uri.AppendPath(testProfileId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestProfilesRequest(int? maxpagesize, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, IEnumerable testProfileIds, IEnumerable testIds, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (lastModifiedStartTime != null) + { + uri.AppendQuery("lastModifiedStartTime", lastModifiedStartTime.Value, "O", true); + } + if (lastModifiedEndTime != null) + { + uri.AppendQuery("lastModifiedEndTime", lastModifiedEndTime.Value, "O", true); + } + if (testProfileIds != null && !(testProfileIds is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("testProfileIds", testProfileIds, ",", true); + } + if (testIds != null && !(testIds is ChangeTrackingList changeTrackingList0 && changeTrackingList0.IsUndefined)) + { + uri.AppendQueryDelimited("testIds", testIds, ",", true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestFilesNextPageRequest(string nextLink, string testId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestsNextPageRequest(string nextLink, string orderby, string search, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestProfilesNextPageRequest(string nextLink, int? maxpagesize, DateTimeOffset? lastModifiedStartTime, DateTimeOffset? lastModifiedEndTime, IEnumerable testProfileIds, IEnumerable testIds, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200201; + private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier201; + private static ResponseClassifier ResponseClassifier201 => _responseClassifier201 ??= new StatusCodeClassifier(stackalloc ushort[] { 201 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestConfiguration.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestConfiguration.Serialization.cs new file mode 100644 index 000000000000..b4a9f6ddead2 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestConfiguration.Serialization.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class LoadTestConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTestConfiguration)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(EngineInstances)) + { + writer.WritePropertyName("engineInstances"u8); + writer.WriteNumberValue(EngineInstances.Value); + } + if (Optional.IsDefined(SplitAllCsvs)) + { + writer.WritePropertyName("splitAllCSVs"u8); + writer.WriteBooleanValue(SplitAllCsvs.Value); + } + if (Optional.IsDefined(QuickStartTest)) + { + writer.WritePropertyName("quickStartTest"u8); + writer.WriteBooleanValue(QuickStartTest.Value); + } + if (Optional.IsDefined(OptionalLoadTestConfiguration)) + { + writer.WritePropertyName("optionalLoadTestConfig"u8); + writer.WriteObjectValue(OptionalLoadTestConfiguration, options); + } + if (Optional.IsCollectionDefined(RegionalLoadTestConfiguration)) + { + writer.WritePropertyName("regionalLoadTestConfig"u8); + writer.WriteStartArray(); + foreach (var item in RegionalLoadTestConfiguration) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LoadTestConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTestConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLoadTestConfiguration(document.RootElement, options); + } + + internal static LoadTestConfiguration DeserializeLoadTestConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? engineInstances = default; + bool? splitAllCSVs = default; + bool? quickStartTest = default; + OptionalLoadTestConfiguration optionalLoadTestConfig = default; + IList regionalLoadTestConfig = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("engineInstances"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + engineInstances = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("splitAllCSVs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + splitAllCSVs = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("quickStartTest"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quickStartTest = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("optionalLoadTestConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + optionalLoadTestConfig = OptionalLoadTestConfiguration.DeserializeOptionalLoadTestConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("regionalLoadTestConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RegionalConfiguration.DeserializeRegionalConfiguration(item, options)); + } + regionalLoadTestConfig = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LoadTestConfiguration( + engineInstances, + splitAllCSVs, + quickStartTest, + optionalLoadTestConfig, + regionalLoadTestConfig ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LoadTestConfiguration)} does not support writing '{options.Format}' format."); + } + } + + LoadTestConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTestConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LoadTestConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LoadTestConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTestConfiguration(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestConfiguration.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestConfiguration.cs new file mode 100644 index 000000000000..028e919c5597 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestConfiguration.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Configurations for the load test. + public partial class LoadTestConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LoadTestConfiguration() + { + RegionalLoadTestConfiguration = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The number of engine instances to execute load test. Supported values are in range of 1-400. Required for creating a new test. + /// + /// If false, Azure Load Testing copies and processes your input files unmodified + /// across all test engine instances. If true, Azure Load Testing splits the CSV + /// input data evenly across all engine instances. If you provide multiple CSV + /// files, each file will be split evenly. + /// + /// + /// If true, optionalLoadTestConfig is required and JMX script for the load test is + /// not required to upload. + /// + /// Configuration for quick load test. + /// Region distribution configuration for the load test. + /// Keeps track of any properties unknown to the library. + internal LoadTestConfiguration(int? engineInstances, bool? splitAllCsvs, bool? quickStartTest, OptionalLoadTestConfiguration optionalLoadTestConfiguration, IList regionalLoadTestConfiguration, IDictionary serializedAdditionalRawData) + { + EngineInstances = engineInstances; + SplitAllCsvs = splitAllCsvs; + QuickStartTest = quickStartTest; + OptionalLoadTestConfiguration = optionalLoadTestConfiguration; + RegionalLoadTestConfiguration = regionalLoadTestConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The number of engine instances to execute load test. Supported values are in range of 1-400. Required for creating a new test. + public int? EngineInstances { get; set; } + /// + /// If false, Azure Load Testing copies and processes your input files unmodified + /// across all test engine instances. If true, Azure Load Testing splits the CSV + /// input data evenly across all engine instances. If you provide multiple CSV + /// files, each file will be split evenly. + /// + public bool? SplitAllCsvs { get; set; } + /// + /// If true, optionalLoadTestConfig is required and JMX script for the load test is + /// not required to upload. + /// + public bool? QuickStartTest { get; set; } + /// Configuration for quick load test. + public OptionalLoadTestConfiguration OptionalLoadTestConfiguration { get; set; } + /// Region distribution configuration for the load test. + public IList RegionalLoadTestConfiguration { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestKind.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestKind.cs new file mode 100644 index 000000000000..4d7a928d4692 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Test kind. + public readonly partial struct LoadTestKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LoadTestKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UrlValue = "URL"; + private const string JmxValue = "JMX"; + private const string LocustValue = "Locust"; + + /// URL Test. + public static LoadTestKind Url { get; } = new LoadTestKind(UrlValue); + /// JMX Test. + public static LoadTestKind Jmx { get; } = new LoadTestKind(JmxValue); + /// Locust Test. + public static LoadTestKind Locust { get; } = new LoadTestKind(LocustValue); + /// Determines if two values are the same. + public static bool operator ==(LoadTestKind left, LoadTestKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LoadTestKind left, LoadTestKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LoadTestKind(string value) => new LoadTestKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LoadTestKind other && Equals(other); + /// + public bool Equals(LoadTestKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRun.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRun.Serialization.cs new file mode 100644 index 000000000000..33c23bacdedf --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRun.Serialization.cs @@ -0,0 +1,689 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class LoadTestRun : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTestRun)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("testRunId"u8); + writer.WriteStringValue(TestRunId); + } + if (Optional.IsDefined(PassFailCriteria)) + { + writer.WritePropertyName("passFailCriteria"u8); + writer.WriteObjectValue(PassFailCriteria, options); + } + if (Optional.IsDefined(AutoStopCriteria)) + { + writer.WritePropertyName("autoStopCriteria"u8); + writer.WriteObjectValue(AutoStopCriteria, options); + } + if (Optional.IsCollectionDefined(Secrets)) + { + writer.WritePropertyName("secrets"u8); + writer.WriteStartObject(); + foreach (var item in Secrets) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Certificate)) + { + writer.WritePropertyName("certificate"u8); + writer.WriteObjectValue(Certificate, options); + } + if (Optional.IsCollectionDefined(EnvironmentVariables)) + { + writer.WritePropertyName("environmentVariables"u8); + writer.WriteStartObject(); + foreach (var item in EnvironmentVariables) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ErrorDetails)) + { + writer.WritePropertyName("errorDetails"u8); + writer.WriteStartArray(); + foreach (var item in ErrorDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(TestRunStatistics)) + { + writer.WritePropertyName("testRunStatistics"u8); + writer.WriteStartObject(); + foreach (var item in TestRunStatistics) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RegionalStatistics)) + { + writer.WritePropertyName("regionalStatistics"u8); + writer.WriteStartObject(); + foreach (var item in RegionalStatistics) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsDefined(LoadTestConfiguration)) + { + writer.WritePropertyName("loadTestConfiguration"u8); + writer.WriteObjectValue(LoadTestConfiguration, options); + } + if (options.Format != "W" && Optional.IsDefined(TestArtifacts)) + { + writer.WritePropertyName("testArtifacts"u8); + writer.WriteObjectValue(TestArtifacts, options); + } + if (options.Format != "W" && Optional.IsDefined(TestResult)) + { + writer.WritePropertyName("testResult"u8); + writer.WriteStringValue(TestResult.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(VirtualUsers)) + { + writer.WritePropertyName("virtualUsers"u8); + writer.WriteNumberValue(VirtualUsers.Value); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(TestId)) + { + writer.WritePropertyName("testId"u8); + writer.WriteStringValue(TestId); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(StartDateTime)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(EndDateTime)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ExecutedDateTime)) + { + writer.WritePropertyName("executedDateTime"u8); + writer.WriteStringValue(ExecutedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(PortalUri)) + { + writer.WritePropertyName("portalUrl"u8); + writer.WriteStringValue(PortalUri.AbsoluteUri); + } + if (options.Format != "W" && Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteNumberValue(Duration.Value); + } + if (options.Format != "W" && Optional.IsDefined(VirtualUserHours)) + { + writer.WritePropertyName("virtualUserHours"u8); + writer.WriteNumberValue(VirtualUserHours.Value); + } + if (options.Format != "W" && Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + if (options.Format != "W" && Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(RequestDataLevel)) + { + writer.WritePropertyName("requestDataLevel"u8); + writer.WriteStringValue(RequestDataLevel.Value.ToString()); + } + if (Optional.IsDefined(DebugLogsEnabled)) + { + writer.WritePropertyName("debugLogsEnabled"u8); + writer.WriteBooleanValue(DebugLogsEnabled.Value); + } + if (options.Format != "W" && Optional.IsDefined(PublicIpDisabled)) + { + writer.WritePropertyName("publicIPDisabled"u8); + writer.WriteBooleanValue(PublicIpDisabled.Value); + } + if (Optional.IsDefined(CreatedByType)) + { + writer.WritePropertyName("createdByType"u8); + writer.WriteStringValue(CreatedByType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LoadTestRun IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTestRun)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLoadTestRun(document.RootElement, options); + } + + internal static LoadTestRun DeserializeLoadTestRun(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string testRunId = default; + PassFailCriteria passFailCriteria = default; + AutoStopCriteria autoStopCriteria = default; + IDictionary secrets = default; + TestCertificate certificate = default; + IDictionary environmentVariables = default; + IReadOnlyList errorDetails = default; + IReadOnlyDictionary testRunStatistics = default; + IReadOnlyDictionary regionalStatistics = default; + LoadTestConfiguration loadTestConfiguration = default; + TestRunArtifacts testArtifacts = default; + PassFailTestResult? testResult = default; + int? virtualUsers = default; + string displayName = default; + string testId = default; + string description = default; + TestRunStatus? status = default; + DateTimeOffset? startDateTime = default; + DateTimeOffset? endDateTime = default; + DateTimeOffset? executedDateTime = default; + Uri portalUrl = default; + long? duration = default; + double? virtualUserHours = default; + string subnetId = default; + LoadTestKind? kind = default; + RequestDataLevel? requestDataLevel = default; + bool? debugLogsEnabled = default; + bool? publicIPDisabled = default; + CreatedByType? createdByType = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("testRunId"u8)) + { + testRunId = property.Value.GetString(); + continue; + } + if (property.NameEquals("passFailCriteria"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + passFailCriteria = PassFailCriteria.DeserializePassFailCriteria(property.Value, options); + continue; + } + if (property.NameEquals("autoStopCriteria"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoStopCriteria = AutoStopCriteria.DeserializeAutoStopCriteria(property.Value, options); + continue; + } + if (property.NameEquals("secrets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, TestSecret.DeserializeTestSecret(property0.Value, options)); + } + secrets = dictionary; + continue; + } + if (property.NameEquals("certificate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificate = TestCertificate.DeserializeTestCertificate(property.Value, options); + continue; + } + if (property.NameEquals("environmentVariables"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + environmentVariables = dictionary; + continue; + } + if (property.NameEquals("errorDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LoadTesting.ErrorDetails.DeserializeErrorDetails(item, options)); + } + errorDetails = array; + continue; + } + if (property.NameEquals("testRunStatistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, LoadTesting.TestRunStatistics.DeserializeTestRunStatistics(property0.Value, options)); + } + testRunStatistics = dictionary; + continue; + } + if (property.NameEquals("regionalStatistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, LoadTesting.TestRunStatistics.DeserializeTestRunStatistics(property0.Value, options)); + } + regionalStatistics = dictionary; + continue; + } + if (property.NameEquals("loadTestConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loadTestConfiguration = LoadTestConfiguration.DeserializeLoadTestConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("testArtifacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + testArtifacts = TestRunArtifacts.DeserializeTestRunArtifacts(property.Value, options); + continue; + } + if (property.NameEquals("testResult"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + testResult = new PassFailTestResult(property.Value.GetString()); + continue; + } + if (property.NameEquals("virtualUsers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualUsers = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("testId"u8)) + { + testId = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new TestRunStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("startDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("executedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + executedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("portalUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + portalUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("duration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("virtualUserHours"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualUserHours = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("subnetId"u8)) + { + subnetId = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new LoadTestKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("requestDataLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestDataLevel = new RequestDataLevel(property.Value.GetString()); + continue; + } + if (property.NameEquals("debugLogsEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + debugLogsEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("publicIPDisabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicIPDisabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("createdByType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LoadTestRun( + testRunId, + passFailCriteria, + autoStopCriteria, + secrets ?? new ChangeTrackingDictionary(), + certificate, + environmentVariables ?? new ChangeTrackingDictionary(), + errorDetails ?? new ChangeTrackingList(), + testRunStatistics ?? new ChangeTrackingDictionary(), + regionalStatistics ?? new ChangeTrackingDictionary(), + loadTestConfiguration, + testArtifacts, + testResult, + virtualUsers, + displayName, + testId, + description, + status, + startDateTime, + endDateTime, + executedDateTime, + portalUrl, + duration, + virtualUserHours, + subnetId, + kind, + requestDataLevel, + debugLogsEnabled, + publicIPDisabled, + createdByType, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LoadTestRun)} does not support writing '{options.Format}' format."); + } + } + + LoadTestRun IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTestRun(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LoadTestRun)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LoadTestRun FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTestRun(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRun.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRun.cs new file mode 100644 index 000000000000..c9c20e57f445 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRun.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Load test run model. + public partial class LoadTestRun + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LoadTestRun() + { + Secrets = new ChangeTrackingDictionary(); + EnvironmentVariables = new ChangeTrackingDictionary(); + ErrorDetails = new ChangeTrackingList(); + TestRunStatistics = new ChangeTrackingDictionary(); + RegionalStatistics = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Pass fail criteria for a test. + /// Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. + /// + /// Secrets can be stored in an Azure Key Vault or any other secret store. If the + /// secret is stored in an Azure Key Vault, the value should be the secret + /// identifier and the type should be AKV_SECRET_URI. If the secret is stored + /// elsewhere, the secret value should be provided directly and the type should be + /// SECRET_VALUE. + /// + /// Certificates metadata. + /// Environment variables which are defined as a set of <name,value> pairs. + /// Error details if there is any failure in load test run. + /// + /// Test run statistics. Key is the sampler name and value is the set of statistics for performance metrics like response time, throughput, etc. from the load test run. + /// The sampler name is the same as the name mentioned in the test script. + /// Sampler name "Total" represents the aggregated statistics of all the samplers. + /// + /// + /// Regional statistics. Key is the Azure region name and value is the test run statistics. + /// The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For example, East US should be passed as "eastus". + /// The region name must match one of the strings in the "Name" column returned from running the "az account list-locations -o table" Azure CLI command. + /// + /// The load test configuration. + /// Collection of test run artifacts. + /// Test result for pass/Fail criteria used during the test run. + /// Number of virtual users, for which test has been run. + /// Display name of a testRun. + /// Associated test Id. + /// The test run description. + /// The test run status. + /// The test run start DateTime(RFC 3339 literal format). + /// The test run end DateTime(RFC 3339 literal format). + /// Test run initiated time. + /// Portal url. + /// Test run duration in milliseconds. + /// Virtual user hours consumed by the test run. + /// Subnet ID on which the load test instances should run. + /// Type of test. + /// Request data collection level for test run. + /// Enable or disable debug level logging. True if debug logs are enabled for the test run. False otherwise. + /// Inject load test engines without deploying public IP for outbound access. + /// The type of the entity that created the test run. (E.x. User, ScheduleTrigger, etc). + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal LoadTestRun(string testRunId, PassFailCriteria passFailCriteria, AutoStopCriteria autoStopCriteria, IDictionary secrets, TestCertificate certificate, IDictionary environmentVariables, IReadOnlyList errorDetails, IReadOnlyDictionary testRunStatistics, IReadOnlyDictionary regionalStatistics, LoadTestConfiguration loadTestConfiguration, TestRunArtifacts testArtifacts, PassFailTestResult? testResult, int? virtualUsers, string displayName, string testId, string description, TestRunStatus? status, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, DateTimeOffset? executedDateTime, Uri portalUri, long? duration, double? virtualUserHours, string subnetId, LoadTestKind? kind, RequestDataLevel? requestDataLevel, bool? debugLogsEnabled, bool? publicIpDisabled, CreatedByType? createdByType, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + TestRunId = testRunId; + PassFailCriteria = passFailCriteria; + AutoStopCriteria = autoStopCriteria; + Secrets = secrets; + Certificate = certificate; + EnvironmentVariables = environmentVariables; + ErrorDetails = errorDetails; + TestRunStatistics = testRunStatistics; + RegionalStatistics = regionalStatistics; + LoadTestConfiguration = loadTestConfiguration; + TestArtifacts = testArtifacts; + TestResult = testResult; + VirtualUsers = virtualUsers; + DisplayName = displayName; + TestId = testId; + Description = description; + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + ExecutedDateTime = executedDateTime; + PortalUri = portalUri; + Duration = duration; + VirtualUserHours = virtualUserHours; + SubnetId = subnetId; + Kind = kind; + RequestDataLevel = requestDataLevel; + DebugLogsEnabled = debugLogsEnabled; + PublicIpDisabled = publicIpDisabled; + CreatedByType = createdByType; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + public string TestRunId { get; } + /// Pass fail criteria for a test. + public PassFailCriteria PassFailCriteria { get; set; } + /// Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. + public AutoStopCriteria AutoStopCriteria { get; set; } + /// + /// Secrets can be stored in an Azure Key Vault or any other secret store. If the + /// secret is stored in an Azure Key Vault, the value should be the secret + /// identifier and the type should be AKV_SECRET_URI. If the secret is stored + /// elsewhere, the secret value should be provided directly and the type should be + /// SECRET_VALUE. + /// + public IDictionary Secrets { get; } + /// Certificates metadata. + public TestCertificate Certificate { get; set; } + /// Environment variables which are defined as a set of <name,value> pairs. + public IDictionary EnvironmentVariables { get; } + /// Error details if there is any failure in load test run. + public IReadOnlyList ErrorDetails { get; } + /// + /// Test run statistics. Key is the sampler name and value is the set of statistics for performance metrics like response time, throughput, etc. from the load test run. + /// The sampler name is the same as the name mentioned in the test script. + /// Sampler name "Total" represents the aggregated statistics of all the samplers. + /// + public IReadOnlyDictionary TestRunStatistics { get; } + /// + /// Regional statistics. Key is the Azure region name and value is the test run statistics. + /// The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For example, East US should be passed as "eastus". + /// The region name must match one of the strings in the "Name" column returned from running the "az account list-locations -o table" Azure CLI command. + /// + public IReadOnlyDictionary RegionalStatistics { get; } + /// The load test configuration. + public LoadTestConfiguration LoadTestConfiguration { get; } + /// Collection of test run artifacts. + public TestRunArtifacts TestArtifacts { get; } + /// Test result for pass/Fail criteria used during the test run. + public PassFailTestResult? TestResult { get; } + /// Number of virtual users, for which test has been run. + public int? VirtualUsers { get; } + /// Display name of a testRun. + public string DisplayName { get; set; } + /// Associated test Id. + public string TestId { get; set; } + /// The test run description. + public string Description { get; set; } + /// The test run status. + public TestRunStatus? Status { get; } + /// The test run start DateTime(RFC 3339 literal format). + public DateTimeOffset? StartDateTime { get; } + /// The test run end DateTime(RFC 3339 literal format). + public DateTimeOffset? EndDateTime { get; } + /// Test run initiated time. + public DateTimeOffset? ExecutedDateTime { get; } + /// Portal url. + public Uri PortalUri { get; } + /// Test run duration in milliseconds. + public long? Duration { get; } + /// Virtual user hours consumed by the test run. + public double? VirtualUserHours { get; } + /// Subnet ID on which the load test instances should run. + public string SubnetId { get; } + /// Type of test. + public LoadTestKind? Kind { get; } + /// Request data collection level for test run. + public RequestDataLevel? RequestDataLevel { get; set; } + /// Enable or disable debug level logging. True if debug logs are enabled for the test run. False otherwise. + public bool? DebugLogsEnabled { get; set; } + /// Inject load test engines without deploying public IP for outbound access. + public bool? PublicIpDisabled { get; } + /// The type of the entity that created the test run. (E.x. User, ScheduleTrigger, etc). + public CreatedByType? CreatedByType { get; set; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRunClient.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRunClient.cs new file mode 100644 index 000000000000..39becf3e5c94 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestRunClient.cs @@ -0,0 +1,2614 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Developer.LoadTesting +{ + // Data plane generated client. + /// The LoadTestRun service client. + public partial class LoadTestRunClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://cnt-prod.loadtesting.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of LoadTestRunClient for mocking. + protected LoadTestRunClient() + { + } + + /// Initializes a new instance of LoadTestRunClient. + /// The to use. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public LoadTestRunClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AzureDeveloperLoadTestingClientOptions()) + { + } + + /// Initializes a new instance of LoadTestRunClient. + /// The to use. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public LoadTestRunClient(Uri endpoint, TokenCredential credential, AzureDeveloperLoadTestingClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AzureDeveloperLoadTestingClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Create and start a new test run with the given test run Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// + /// Existing test run identifier that should be rerun, if this is provided, the + /// test will run with the JMX file, configuration and app components from the + /// existing test run. You can override the configuration values for new test run + /// in the request body. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task CreateOrUpdateTestRunAsync(string testRunId, RequestContent content, string oldTestRunId = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestRunRequest(testRunId, content, oldTestRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create and start a new test run with the given test run Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// + /// Existing test run identifier that should be rerun, if this is provided, the + /// test will run with the JMX file, configuration and app components from the + /// existing test run. You can override the configuration values for new test run + /// in the request body. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response CreateOrUpdateTestRun(string testRunId, RequestContent content, string oldTestRunId = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestRunRequest(testRunId, content, oldTestRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Add an app component to a test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique Id for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrUpdateAppComponentsAsync(string testRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateAppComponentsRequest(testRunId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Add an app component to a test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique Id for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrUpdateAppComponents(string testRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateAppComponentsRequest(testRunId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Configure server metrics for a test run + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique Id for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrUpdateServerMetricsConfigAsync(string testRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateServerMetricsConfigRequest(testRunId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Configure server metrics for a test run + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// + /// Unique Id for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrUpdateServerMetricsConfig(string testRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateServerMetricsConfigRequest(testRunId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete an existing load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteTestRunAsync(string testRunId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.DeleteTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestRunRequest(testRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete an existing load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteTestRun(string testRunId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.DeleteTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestRunRequest(testRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get associated app component (collection of azure resources) for the given test + /// run. + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetAppComponentsAsync(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAppComponentsAsync(testRunId, context).ConfigureAwait(false); + return Response.FromValue(TestRunAppComponents.FromResponse(response), response); + } + + /// + /// Get associated app component (collection of azure resources) for the given test + /// run. + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetAppComponents(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAppComponents(testRunId, context); + return Response.FromValue(TestRunAppComponents.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get associated app component (collection of azure resources) for the given test + /// run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetAppComponentsAsync(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAppComponentsRequest(testRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get associated app component (collection of azure resources) for the given test + /// run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetAppComponents(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetAppComponents"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAppComponentsRequest(testRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get associated server metrics configuration for the given test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetServerMetricsConfigAsync(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetServerMetricsConfigAsync(testRunId, context).ConfigureAwait(false); + return Response.FromValue(TestRunServerMetricsConfiguration.FromResponse(response), response); + } + + /// Get associated server metrics configuration for the given test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetServerMetricsConfig(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetServerMetricsConfig(testRunId, context); + return Response.FromValue(TestRunServerMetricsConfiguration.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get associated server metrics configuration for the given test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetServerMetricsConfigAsync(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateGetServerMetricsConfigRequest(testRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get associated server metrics configuration for the given test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetServerMetricsConfig(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetServerMetricsConfig"); + scope.Start(); + try + { + using HttpMessage message = CreateGetServerMetricsConfigRequest(testRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get test run details by test run Id. + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetTestRunAsync(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetTestRunAsync(testRunId, context).ConfigureAwait(false); + return Response.FromValue(LoadTestRun.FromResponse(response), response); + } + + /// Get test run details by test run Id. + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetTestRun(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetTestRun(testRunId, context); + return Response.FromValue(LoadTestRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get test run details by test run Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetTestRunAsync(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestRunRequest(testRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get test run details by test run Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetTestRun(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestRunRequest(testRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get test run file by file name. + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetTestRunFileAsync(string testRunId, string fileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetTestRunFileAsync(testRunId, fileName, context).ConfigureAwait(false); + return Response.FromValue(TestRunFileInfo.FromResponse(response), response); + } + + /// Get test run file by file name. + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetTestRunFile(string testRunId, string fileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetTestRunFile(testRunId, fileName, context); + return Response.FromValue(TestRunFileInfo.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get test run file by file name. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetTestRunFileAsync(string testRunId, string fileName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetTestRunFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestRunFileRequest(testRunId, fileName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get test run file by file name. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Name of the file. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetTestRunFile(string testRunId, string fileName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetTestRunFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestRunFileRequest(testRunId, fileName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the metric definitions for a load test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric namespace to query metric definitions for. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetMetricDefinitionsAsync(string testRunId, string metricNamespace, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetMetricDefinitionsAsync(testRunId, metricNamespace, context).ConfigureAwait(false); + return Response.FromValue(MetricDefinitions.FromResponse(response), response); + } + + /// List the metric definitions for a load test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric namespace to query metric definitions for. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetMetricDefinitions(string testRunId, string metricNamespace, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetMetricDefinitions(testRunId, metricNamespace, context); + return Response.FromValue(MetricDefinitions.FromResponse(response), response); + } + + /// + /// [Protocol Method] List the metric definitions for a load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric namespace to query metric definitions for. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetMetricDefinitionsAsync(string testRunId, string metricNamespace, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetMetricDefinitions"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMetricDefinitionsRequest(testRunId, metricNamespace, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] List the metric definitions for a load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric namespace to query metric definitions for. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetMetricDefinitions(string testRunId, string metricNamespace, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetMetricDefinitions"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMetricDefinitionsRequest(testRunId, metricNamespace, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the metric namespaces for a load test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetMetricNamespacesAsync(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetMetricNamespacesAsync(testRunId, context).ConfigureAwait(false); + return Response.FromValue(MetricNamespaces.FromResponse(response), response); + } + + /// List the metric namespaces for a load test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetMetricNamespaces(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetMetricNamespaces(testRunId, context); + return Response.FromValue(MetricNamespaces.FromResponse(response), response); + } + + /// + /// [Protocol Method] List the metric namespaces for a load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetMetricNamespacesAsync(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetMetricNamespaces"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMetricNamespacesRequest(testRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] List the metric namespaces for a load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetMetricNamespaces(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetMetricNamespaces"); + scope.Start(); + try + { + using HttpMessage message = CreateGetMetricNamespacesRequest(testRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Stop test run by test run Id. + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> StopTestRunAsync(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await StopTestRunAsync(testRunId, context).ConfigureAwait(false); + return Response.FromValue(LoadTestRun.FromResponse(response), response); + } + + /// Stop test run by test run Id. + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response StopTestRun(string testRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = StopTestRun(testRunId, context); + return Response.FromValue(LoadTestRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Stop test run by test run Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task StopTestRunAsync(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.StopTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateStopTestRunRequest(testRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Stop test run by test run Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response StopTestRun(string testRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.StopTestRun"); + scope.Start(); + try + { + using HttpMessage message = CreateStopTestRunRequest(testRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create and start a new test profile run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task CreateOrUpdateTestProfileRunAsync(string testProfileRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestProfileRunRequest(testProfileRunId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create and start a new test profile run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response CreateOrUpdateTestProfileRun(string testProfileRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.CreateOrUpdateTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateTestProfileRunRequest(testProfileRunId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete an existing load test profile run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteTestProfileRunAsync(string testProfileRunId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.DeleteTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestProfileRunRequest(testProfileRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete an existing load test profile run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteTestProfileRun(string testProfileRunId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.DeleteTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteTestProfileRunRequest(testProfileRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get test profile run details. + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Get test profile run details by test profile run Id. + /// + public virtual async Task> GetTestProfileRunAsync(string testProfileRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetTestProfileRunAsync(testProfileRunId, context).ConfigureAwait(false); + return Response.FromValue(TestProfileRun.FromResponse(response), response); + } + + /// Get test profile run details. + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Get test profile run details by test profile run Id. + /// + public virtual Response GetTestProfileRun(string testProfileRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetTestProfileRun(testProfileRunId, context); + return Response.FromValue(TestProfileRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get test profile run details. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetTestProfileRunAsync(string testProfileRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestProfileRunRequest(testProfileRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get test profile run details. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetTestProfileRun(string testProfileRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.GetTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTestProfileRunRequest(testProfileRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Stop test profile run. + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Stop test profile run for the given test profile run Id. + /// + public virtual async Task> StopTestProfileRunAsync(string testProfileRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await StopTestProfileRunAsync(testProfileRunId, context).ConfigureAwait(false); + return Response.FromValue(TestProfileRun.FromResponse(response), response); + } + + /// Stop test profile run. + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Stop test profile run for the given test profile run Id. + /// + public virtual Response StopTestProfileRun(string testProfileRunId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = StopTestProfileRun(testProfileRunId, context); + return Response.FromValue(TestProfileRun.FromResponse(response), response); + } + + /// + /// [Protocol Method] Stop test profile run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task StopTestProfileRunAsync(string testProfileRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.StopTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateStopTestProfileRunRequest(testProfileRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Stop test profile run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response StopTestProfileRun(string testProfileRunId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testProfileRunId, nameof(testProfileRunId)); + + using var scope = ClientDiagnostics.CreateScope("LoadTestRunClient.StopTestProfileRun"); + scope.Start(); + try + { + using HttpMessage message = CreateStopTestProfileRunRequest(testProfileRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the dimension values for the given metric dimension name. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Dimension name. + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// The interval (i.e. timegrain) of the query. + /// The cancellation token to use. + /// , , , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetMetricDimensionValuesAsync(string testRunId, string name, string metricname, string metricNamespace, string timespan, TimeGrain? interval = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricname, metricNamespace, timespan, interval?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricname, metricNamespace, timespan, interval?.ToString(), context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => e.GetString(), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetricDimensionValues", "value", "nextLink", context); + } + + /// List the dimension values for the given metric dimension name. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Dimension name. + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// The interval (i.e. timegrain) of the query. + /// The cancellation token to use. + /// , , , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetMetricDimensionValues(string testRunId, string name, string metricname, string metricNamespace, string timespan, TimeGrain? interval = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricname, metricNamespace, timespan, interval?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricname, metricNamespace, timespan, interval?.ToString(), context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => e.GetString(), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetricDimensionValues", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List the dimension values for the given metric dimension name. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Dimension name. + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// The interval (i.e. timegrain) of the query. Allowed values: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , , , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetMetricDimensionValuesAsync(string testRunId, string name, string metricname, string metricNamespace, string timespan, string interval, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricname, metricNamespace, timespan, interval, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricname, metricNamespace, timespan, interval, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetricDimensionValues", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List the dimension values for the given metric dimension name. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Dimension name. + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// The interval (i.e. timegrain) of the query. Allowed values: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , , , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetMetricDimensionValues(string testRunId, string name, string metricname, string metricNamespace, string timespan, string interval, RequestContext context) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricname, metricNamespace, timespan, interval, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricname, metricNamespace, timespan, interval, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetricDimensionValues", "value", "nextLink", context); + } + + /// List the metric values for a load test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// Metric dimension filter. + /// The aggregation. + /// The interval (i.e. timegrain) of the query. + /// The cancellation token to use. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetMetricsAsync(string testRunId, string metricname, string metricNamespace, string timespan, MetricsFilters body = null, string aggregation = null, TimeGrain? interval = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + RequestContent content = body?.ToRequestContent(); + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricsRequest(testRunId, metricname, metricNamespace, timespan, content, aggregation, interval?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricsNextPageRequest(nextLink, testRunId, metricname, metricNamespace, timespan, content, aggregation, interval?.ToString(), context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => TimeSeriesElement.DeserializeTimeSeriesElement(e), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetrics", "value", "nextLink", context); + } + + /// List the metric values for a load test run. + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// Metric dimension filter. + /// The aggregation. + /// The interval (i.e. timegrain) of the query. + /// The cancellation token to use. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetMetrics(string testRunId, string metricname, string metricNamespace, string timespan, MetricsFilters body = null, string aggregation = null, TimeGrain? interval = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + RequestContent content = body?.ToRequestContent(); + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricsRequest(testRunId, metricname, metricNamespace, timespan, content, aggregation, interval?.ToString(), context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricsNextPageRequest(nextLink, testRunId, metricname, metricNamespace, timespan, content, aggregation, interval?.ToString(), context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => TimeSeriesElement.DeserializeTimeSeriesElement(e), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetrics", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List the metric values for a load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// The content to send as the body of the request. + /// The aggregation. + /// The interval (i.e. timegrain) of the query. Allowed values: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetMetricsAsync(string testRunId, string metricname, string metricNamespace, string timespan, RequestContent content, string aggregation = null, string interval = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricsRequest(testRunId, metricname, metricNamespace, timespan, content, aggregation, interval, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricsNextPageRequest(nextLink, testRunId, metricname, metricNamespace, timespan, content, aggregation, interval, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetrics", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List the metric values for a load test run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Unique name for the load test run, must contain only lower-case alphabetic, + /// numeric, underscore or hyphen characters. + /// + /// Metric name. + /// Metric namespace to query metric definitions for. + /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + /// The content to send as the body of the request. + /// The aggregation. + /// The interval (i.e. timegrain) of the query. Allowed values: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H". + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetMetrics(string testRunId, string metricname, string metricNamespace, string timespan, RequestContent content, string aggregation = null, string interval = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); + Argument.AssertNotNull(metricname, nameof(metricname)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(timespan, nameof(timespan)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricsRequest(testRunId, metricname, metricNamespace, timespan, content, aggregation, interval, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricsNextPageRequest(nextLink, testRunId, metricname, metricNamespace, timespan, content, aggregation, interval, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetMetrics", "value", "nextLink", context); + } + + /// Get all test runs for the given filters. + /// + /// Sort on the supported fields in (field asc/desc) format. eg: executedDateTime + /// asc. Supported fields - executedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - description, + /// executedUser. For example, to search for a test run, with description 500 VUs, + /// the search parameter can be 500. + /// + /// Unique name of an existing load test. + /// Start DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// End DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// Comma separated list of test run status. + /// Number of results in response. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetTestRunsAsync(string orderby = null, string search = null, string testId = null, DateTimeOffset? executionFrom = null, DateTimeOffset? executionTo = null, string status = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestRunsRequest(orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestRunsNextPageRequest(nextLink, orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => LoadTestRun.DeserializeLoadTestRun(e), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestRuns", "value", "nextLink", maxpagesize, context); + } + + /// Get all test runs for the given filters. + /// + /// Sort on the supported fields in (field asc/desc) format. eg: executedDateTime + /// asc. Supported fields - executedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - description, + /// executedUser. For example, to search for a test run, with description 500 VUs, + /// the search parameter can be 500. + /// + /// Unique name of an existing load test. + /// Start DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// End DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// Comma separated list of test run status. + /// Number of results in response. + /// The cancellation token to use. + /// + public virtual Pageable GetTestRuns(string orderby = null, string search = null, string testId = null, DateTimeOffset? executionFrom = null, DateTimeOffset? executionTo = null, string status = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestRunsRequest(orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestRunsNextPageRequest(nextLink, orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => LoadTestRun.DeserializeLoadTestRun(e), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestRuns", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] Get all test runs for the given filters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Sort on the supported fields in (field asc/desc) format. eg: executedDateTime + /// asc. Supported fields - executedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - description, + /// executedUser. For example, to search for a test run, with description 500 VUs, + /// the search parameter can be 500. + /// + /// Unique name of an existing load test. + /// Start DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// End DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// Comma separated list of test run status. + /// Number of results in response. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetTestRunsAsync(string orderby, string search, string testId, DateTimeOffset? executionFrom, DateTimeOffset? executionTo, string status, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestRunsRequest(orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestRunsNextPageRequest(nextLink, orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestRuns", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] Get all test runs for the given filters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// + /// Sort on the supported fields in (field asc/desc) format. eg: executedDateTime + /// asc. Supported fields - executedDateTime + /// + /// + /// Prefix based, case sensitive search on searchable fields - description, + /// executedUser. For example, to search for a test run, with description 500 VUs, + /// the search parameter can be 500. + /// + /// Unique name of an existing load test. + /// Start DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// End DateTime(RFC 3339 literal format) of test-run execution time filter range. + /// Comma separated list of test run status. + /// Number of results in response. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetTestRuns(string orderby, string search, string testId, DateTimeOffset? executionFrom, DateTimeOffset? executionTo, string status, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestRunsRequest(orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestRunsNextPageRequest(nextLink, orderby, search, testId, executionFrom, executionTo, status, pageSizeHint, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestRuns", "value", "nextLink", maxpagesize, context); + } + + /// List test profile runs. + /// Maximum number of results to include in a single response. + /// Minimum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Minimum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Start DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// End DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// Comma separated list of IDs of the test profile runs to filter. + /// Comma separated IDs of the test profiles which should be associated with the test profile runs to fetch. + /// Comma separated list of Statuses of the test profile runs to filter. + /// The cancellation token to use. + /// Get all test profile runs for the given filters. + /// + public virtual AsyncPageable GetTestProfileRunsAsync(int? maxpagesize = null, DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, DateTimeOffset? createdDateStartTime = null, DateTimeOffset? createdDateEndTime = null, IEnumerable testProfileRunIds = null, IEnumerable testProfileIds = null, IEnumerable statuses = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfileRunsRequest(pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfileRunsNextPageRequest(nextLink, pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => TestProfileRun.DeserializeTestProfileRun(e), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestProfileRuns", "value", "nextLink", maxpagesize, context); + } + + /// List test profile runs. + /// Maximum number of results to include in a single response. + /// Minimum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Minimum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Start DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// End DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// Comma separated list of IDs of the test profile runs to filter. + /// Comma separated IDs of the test profiles which should be associated with the test profile runs to fetch. + /// Comma separated list of Statuses of the test profile runs to filter. + /// The cancellation token to use. + /// Get all test profile runs for the given filters. + /// + public virtual Pageable GetTestProfileRuns(int? maxpagesize = null, DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, DateTimeOffset? createdDateStartTime = null, DateTimeOffset? createdDateEndTime = null, IEnumerable testProfileRunIds = null, IEnumerable testProfileIds = null, IEnumerable statuses = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfileRunsRequest(pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfileRunsNextPageRequest(nextLink, pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => TestProfileRun.DeserializeTestProfileRun(e), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestProfileRuns", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] List test profile runs. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Maximum number of results to include in a single response. + /// Minimum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Minimum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Start DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// End DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// Comma separated list of IDs of the test profile runs to filter. + /// Comma separated IDs of the test profiles which should be associated with the test profile runs to fetch. + /// Comma separated list of Statuses of the test profile runs to filter. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetTestProfileRunsAsync(int? maxpagesize, DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, DateTimeOffset? createdDateStartTime, DateTimeOffset? createdDateEndTime, IEnumerable testProfileRunIds, IEnumerable testProfileIds, IEnumerable statuses, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfileRunsRequest(pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfileRunsNextPageRequest(nextLink, pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestProfileRuns", "value", "nextLink", maxpagesize, context); + } + + /// + /// [Protocol Method] List test profile runs. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Maximum number of results to include in a single response. + /// Minimum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Minimum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Maximum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + /// Start DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// End DateTime(RFC 3339 literal format) of the created time range to filter test profile runs. + /// Comma separated list of IDs of the test profile runs to filter. + /// Comma separated IDs of the test profiles which should be associated with the test profile runs to fetch. + /// Comma separated list of Statuses of the test profile runs to filter. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetTestProfileRuns(int? maxpagesize, DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, DateTimeOffset? createdDateStartTime, DateTimeOffset? createdDateEndTime, IEnumerable testProfileRunIds, IEnumerable testProfileIds, IEnumerable statuses, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTestProfileRunsRequest(pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTestProfileRunsNextPageRequest(nextLink, pageSizeHint, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "LoadTestRunClient.GetTestProfileRuns", "value", "nextLink", maxpagesize, context); + } + + internal HttpMessage CreateCreateOrUpdateTestRunRequest(string testRunId, RequestContent content, string oldTestRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (oldTestRunId != null) + { + uri.AppendQuery("oldTestRunId", oldTestRunId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCreateOrUpdateAppComponentsRequest(string testRunId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/app-components", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCreateOrUpdateServerMetricsConfigRequest(string testRunId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/server-metrics-config", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteTestRunRequest(string testRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAppComponentsRequest(string testRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/app-components", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetServerMetricsConfigRequest(string testRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/server-metrics-config", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestRunRequest(string testRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestRunFileRequest(string testRunId, string fileName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/files/", false); + uri.AppendPath(fileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMetricDimensionValuesRequest(string testRunId, string name, string metricname, string metricNamespace, string timespan, string interval, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/metric-dimensions/", false); + uri.AppendPath(name, true); + uri.AppendPath("/values", false); + uri.AppendQuery("metricname", metricname, true); + uri.AppendQuery("metricNamespace", metricNamespace, true); + uri.AppendQuery("timespan", timespan, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (interval != null) + { + uri.AppendQuery("interval", interval, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMetricDefinitionsRequest(string testRunId, string metricNamespace, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/metric-definitions", false); + uri.AppendQuery("metricNamespace", metricNamespace, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMetricNamespacesRequest(string testRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/metric-namespaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMetricsRequest(string testRunId, string metricname, string metricNamespace, string timespan, RequestContent content, string aggregation, string interval, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath("/metrics", false); + uri.AppendQuery("metricname", metricname, true); + uri.AppendQuery("metricNamespace", metricNamespace, true); + uri.AppendQuery("timespan", timespan, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (aggregation != null) + { + uri.AppendQuery("aggregation", aggregation, true); + } + if (interval != null) + { + uri.AppendQuery("interval", interval, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetTestRunsRequest(string orderby, string search, string testId, DateTimeOffset? executionFrom, DateTimeOffset? executionTo, string status, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (orderby != null) + { + uri.AppendQuery("orderby", orderby, true); + } + if (search != null) + { + uri.AppendQuery("search", search, true); + } + if (testId != null) + { + uri.AppendQuery("testId", testId, true); + } + if (executionFrom != null) + { + uri.AppendQuery("executionFrom", executionFrom.Value, "O", true); + } + if (executionTo != null) + { + uri.AppendQuery("executionTo", executionTo.Value, "O", true); + } + if (status != null) + { + uri.AppendQuery("status", status, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateStopTestRunRequest(string testRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-runs/", false); + uri.AppendPath(testRunId, true); + uri.AppendPath(":stop", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateTestProfileRunRequest(string testProfileRunId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profile-runs/", false); + uri.AppendPath(testProfileRunId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteTestProfileRunRequest(string testProfileRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profile-runs/", false); + uri.AppendPath(testProfileRunId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestProfileRunRequest(string testProfileRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profile-runs/", false); + uri.AppendPath(testProfileRunId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestProfileRunsRequest(int? maxpagesize, DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, DateTimeOffset? createdDateStartTime, DateTimeOffset? createdDateEndTime, IEnumerable testProfileRunIds, IEnumerable testProfileIds, IEnumerable statuses, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profile-runs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (minStartDateTime != null) + { + uri.AppendQuery("minStartDateTime", minStartDateTime.Value, "O", true); + } + if (maxStartDateTime != null) + { + uri.AppendQuery("maxStartDateTime", maxStartDateTime.Value, "O", true); + } + if (minEndDateTime != null) + { + uri.AppendQuery("minEndDateTime", minEndDateTime.Value, "O", true); + } + if (maxEndDateTime != null) + { + uri.AppendQuery("maxEndDateTime", maxEndDateTime.Value, "O", true); + } + if (createdDateStartTime != null) + { + uri.AppendQuery("createdDateStartTime", createdDateStartTime.Value, "O", true); + } + if (createdDateEndTime != null) + { + uri.AppendQuery("createdDateEndTime", createdDateEndTime.Value, "O", true); + } + if (testProfileRunIds != null && !(testProfileRunIds is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("testProfileRunIds", testProfileRunIds, ",", true); + } + if (testProfileIds != null && !(testProfileIds is ChangeTrackingList changeTrackingList0 && changeTrackingList0.IsUndefined)) + { + uri.AppendQueryDelimited("testProfileIds", testProfileIds, ",", true); + } + if (statuses != null && !(statuses is ChangeTrackingList changeTrackingList1 && changeTrackingList1.IsUndefined)) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateStopTestProfileRunRequest(string testProfileRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendPath("/test-profile-runs/", false); + uri.AppendPath(testProfileRunId, true); + uri.AppendPath(":stop", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMetricDimensionValuesNextPageRequest(string nextLink, string testRunId, string name, string metricname, string metricNamespace, string timespan, string interval, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMetricsNextPageRequest(string nextLink, string testRunId, string metricname, string metricNamespace, string timespan, RequestContent content, string aggregation, string interval, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestRunsNextPageRequest(string nextLink, string orderby, string search, string testId, DateTimeOffset? executionFrom, DateTimeOffset? executionTo, string status, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTestProfileRunsNextPageRequest(string nextLink, int? maxpagesize, DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, DateTimeOffset? createdDateStartTime, DateTimeOffset? createdDateEndTime, IEnumerable testProfileRunIds, IEnumerable testProfileIds, IEnumerable statuses, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw("https://", false); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200201; + private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingAppComponent.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingAppComponent.Serialization.cs new file mode 100644 index 000000000000..f96a81a46548 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingAppComponent.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class LoadTestingAppComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTestingAppComponent)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + writer.WritePropertyName("resourceName"u8); + writer.WriteStringValue(ResourceName); + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(ResourceGroup)) + { + writer.WritePropertyName("resourceGroup"u8); + writer.WriteStringValue(ResourceGroup); + } + if (options.Format != "W" && Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LoadTestingAppComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadTestingAppComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLoadTestingAppComponent(document.RootElement, options); + } + + internal static LoadTestingAppComponent DeserializeLoadTestingAppComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier resourceId = default; + string resourceName = default; + string resourceType = default; + string displayName = default; + string resourceGroup = default; + string subscriptionId = default; + string kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceName"u8)) + { + resourceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LoadTestingAppComponent( + resourceId, + resourceName, + resourceType, + displayName, + resourceGroup, + subscriptionId, + kind, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LoadTestingAppComponent)} does not support writing '{options.Format}' format."); + } + } + + LoadTestingAppComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTestingAppComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LoadTestingAppComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LoadTestingAppComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadTestingAppComponent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingAppComponent.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingAppComponent.cs new file mode 100644 index 000000000000..ecd42ad181a8 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingAppComponent.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// An Azure resource object (Refer azure generic resource model :https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id#genericresource). + public partial class LoadTestingAppComponent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Azure resource name, required while creating the app component. + /// Azure resource type, required while creating the app component. + /// or is null. + public LoadTestingAppComponent(string resourceName, string resourceType) + { + Argument.AssertNotNull(resourceName, nameof(resourceName)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + ResourceName = resourceName; + ResourceType = resourceType; + } + + /// Initializes a new instance of . + /// fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + /// Azure resource name, required while creating the app component. + /// Azure resource type, required while creating the app component. + /// Azure resource display name. + /// Resource group name of the Azure resource. + /// Subscription Id of the Azure resource. + /// Kind of Azure resource type. + /// Keeps track of any properties unknown to the library. + internal LoadTestingAppComponent(ResourceIdentifier resourceId, string resourceName, string resourceType, string displayName, string resourceGroup, string subscriptionId, string kind, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + ResourceName = resourceName; + ResourceType = resourceType; + DisplayName = displayName; + ResourceGroup = resourceGroup; + SubscriptionId = subscriptionId; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LoadTestingAppComponent() + { + } + + /// fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + public ResourceIdentifier ResourceId { get; } + /// Azure resource name, required while creating the app component. + public string ResourceName { get; set; } + /// Azure resource type, required while creating the app component. + public string ResourceType { get; set; } + /// Azure resource display name. + public string DisplayName { get; set; } + /// Resource group name of the Azure resource. + public string ResourceGroup { get; } + /// Subscription Id of the Azure resource. + public string SubscriptionId { get; } + /// Kind of Azure resource type. + public string Kind { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingFileType.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingFileType.cs new file mode 100644 index 000000000000..78387b0fae18 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingFileType.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Types of file supported. + public readonly partial struct LoadTestingFileType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LoadTestingFileType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string JmxFileValue = "JMX_FILE"; + private const string UserPropertiesValue = "USER_PROPERTIES"; + private const string AdditionalArtifactsValue = "ADDITIONAL_ARTIFACTS"; + private const string ZippedArtifactsValue = "ZIPPED_ARTIFACTS"; + private const string UrlTestConfigValue = "URL_TEST_CONFIG"; + private const string TestScriptValue = "TEST_SCRIPT"; + + /// If the file is a JMX script. + public static LoadTestingFileType JmxFile { get; } = new LoadTestingFileType(JmxFileValue); + /// If the file is a user properties file. + public static LoadTestingFileType UserProperties { get; } = new LoadTestingFileType(UserPropertiesValue); + /// If the file is not among any of the other supported file types. + public static LoadTestingFileType AdditionalArtifacts { get; } = new LoadTestingFileType(AdditionalArtifactsValue); + /// If the file is a compressed archive containing a collection of various artifacts or resources. + public static LoadTestingFileType ZippedArtifacts { get; } = new LoadTestingFileType(ZippedArtifactsValue); + /// If the file is a JSON config file to define the requests for a URL test. + public static LoadTestingFileType UrlTestConfig { get; } = new LoadTestingFileType(UrlTestConfigValue); + /// If the file is a test script. + public static LoadTestingFileType TestScript { get; } = new LoadTestingFileType(TestScriptValue); + /// Determines if two values are the same. + public static bool operator ==(LoadTestingFileType left, LoadTestingFileType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LoadTestingFileType left, LoadTestingFileType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LoadTestingFileType(string value) => new LoadTestingFileType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LoadTestingFileType other && Equals(other); + /// + public bool Equals(LoadTestingFileType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingManagedIdentityType.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingManagedIdentityType.cs new file mode 100644 index 000000000000..3919a0d3c86d --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/LoadTestingManagedIdentityType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Managed identity type. + public readonly partial struct LoadTestingManagedIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LoadTestingManagedIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedValue = "SystemAssigned"; + private const string UserAssignedValue = "UserAssigned"; + + /// System-assigned managed identity. + public static LoadTestingManagedIdentityType SystemAssigned { get; } = new LoadTestingManagedIdentityType(SystemAssignedValue); + /// User-assigned managed identity. + public static LoadTestingManagedIdentityType UserAssigned { get; } = new LoadTestingManagedIdentityType(UserAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(LoadTestingManagedIdentityType left, LoadTestingManagedIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LoadTestingManagedIdentityType left, LoadTestingManagedIdentityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LoadTestingManagedIdentityType(string value) => new LoadTestingManagedIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LoadTestingManagedIdentityType other && Equals(other); + /// + public bool Equals(LoadTestingManagedIdentityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricAvailability.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricAvailability.Serialization.cs new file mode 100644 index 000000000000..5fb71e167bf6 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricAvailability.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class MetricAvailability : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricAvailability)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(TimeGrain)) + { + writer.WritePropertyName("timeGrain"u8); + writer.WriteStringValue(TimeGrain.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MetricAvailability IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricAvailability)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricAvailability(document.RootElement, options); + } + + internal static MetricAvailability DeserializeMetricAvailability(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TimeGrain? timeGrain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timeGrain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeGrain = new TimeGrain(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetricAvailability(timeGrain, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MetricAvailability)} does not support writing '{options.Format}' format."); + } + } + + MetricAvailability IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricAvailability(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricAvailability)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MetricAvailability FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricAvailability(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricAvailability.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricAvailability.cs new file mode 100644 index 000000000000..7634872e8667 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricAvailability.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Metric availability specifies the time grain (aggregation interval or frequency). + public partial class MetricAvailability + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MetricAvailability() + { + } + + /// Initializes a new instance of . + /// + /// The time grain specifies the aggregation interval for the metric. Expressed as + /// a duration 'PT1M', 'PT1H', etc. + /// + /// Keeps track of any properties unknown to the library. + internal MetricAvailability(TimeGrain? timeGrain, IDictionary serializedAdditionalRawData) + { + TimeGrain = timeGrain; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The time grain specifies the aggregation interval for the metric. Expressed as + /// a duration 'PT1M', 'PT1H', etc. + /// + public TimeGrain? TimeGrain { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinition.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinition.Serialization.cs new file mode 100644 index 000000000000..36725c36bc6d --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinition.Serialization.cs @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class MetricDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricDefinition)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Dimensions)) + { + writer.WritePropertyName("dimensions"u8); + writer.WriteStartArray(); + foreach (var item in Dimensions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Namespace)) + { + writer.WritePropertyName("namespace"u8); + writer.WriteStringValue(Namespace); + } + if (Optional.IsDefined(PrimaryAggregationType)) + { + writer.WritePropertyName("primaryAggregationType"u8); + writer.WriteStringValue(PrimaryAggregationType.Value.ToString()); + } + if (Optional.IsCollectionDefined(SupportedAggregationTypes)) + { + writer.WritePropertyName("supportedAggregationTypes"u8); + writer.WriteStartArray(); + foreach (var item in SupportedAggregationTypes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.Value.ToString()); + } + if (Optional.IsCollectionDefined(MetricAvailabilities)) + { + writer.WritePropertyName("metricAvailabilities"u8); + writer.WriteStartArray(); + foreach (var item in MetricAvailabilities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MetricDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricDefinition(document.RootElement, options); + } + + internal static MetricDefinition DeserializeMetricDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dimensions = default; + string description = default; + string name = default; + string @namespace = default; + AggregationType? primaryAggregationType = default; + IReadOnlyList supportedAggregationTypes = default; + MetricUnit? unit = default; + IReadOnlyList metricAvailabilities = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dimensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NameAndDescription.DeserializeNameAndDescription(item, options)); + } + dimensions = array; + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("primaryAggregationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primaryAggregationType = new AggregationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("supportedAggregationTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + supportedAggregationTypes = array; + continue; + } + if (property.NameEquals("unit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + unit = new MetricUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metricAvailabilities"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricAvailability.DeserializeMetricAvailability(item, options)); + } + metricAvailabilities = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetricDefinition( + dimensions ?? new ChangeTrackingList(), + description, + name, + @namespace, + primaryAggregationType, + supportedAggregationTypes ?? new ChangeTrackingList(), + unit, + metricAvailabilities ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MetricDefinition)} does not support writing '{options.Format}' format."); + } + } + + MetricDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MetricDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricDefinition(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinition.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinition.cs new file mode 100644 index 000000000000..7fb3baf52391 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinition.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Metric definition. + public partial class MetricDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MetricDefinition() + { + Dimensions = new ChangeTrackingList(); + SupportedAggregationTypes = new ChangeTrackingList(); + MetricAvailabilities = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of dimensions. + /// The metric description. + /// The metric name. + /// The namespace the metric belongs to. + /// The primary aggregation type value defining how to use the values for display. + /// The collection of what all aggregation types are supported. + /// The unit of the metric. + /// + /// Metric availability specifies the time grain (aggregation interval or + /// frequency). + /// + /// Keeps track of any properties unknown to the library. + internal MetricDefinition(IReadOnlyList dimensions, string description, string name, string @namespace, AggregationType? primaryAggregationType, IReadOnlyList supportedAggregationTypes, MetricUnit? unit, IReadOnlyList metricAvailabilities, IDictionary serializedAdditionalRawData) + { + Dimensions = dimensions; + Description = description; + Name = name; + Namespace = @namespace; + PrimaryAggregationType = primaryAggregationType; + SupportedAggregationTypes = supportedAggregationTypes; + Unit = unit; + MetricAvailabilities = metricAvailabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of dimensions. + public IReadOnlyList Dimensions { get; } + /// The metric description. + public string Description { get; } + /// The metric name. + public string Name { get; } + /// The namespace the metric belongs to. + public string Namespace { get; } + /// The primary aggregation type value defining how to use the values for display. + public AggregationType? PrimaryAggregationType { get; } + /// The collection of what all aggregation types are supported. + public IReadOnlyList SupportedAggregationTypes { get; } + /// The unit of the metric. + public MetricUnit? Unit { get; } + /// + /// Metric availability specifies the time grain (aggregation interval or + /// frequency). + /// + public IReadOnlyList MetricAvailabilities { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinitions.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinitions.Serialization.cs new file mode 100644 index 000000000000..64984c2a284f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinitions.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class MetricDefinitions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricDefinitions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MetricDefinitions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricDefinitions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricDefinitions(document.RootElement, options); + } + + internal static MetricDefinitions DeserializeMetricDefinitions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricDefinition.DeserializeMetricDefinition(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetricDefinitions(value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MetricDefinitions)} does not support writing '{options.Format}' format."); + } + } + + MetricDefinitions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricDefinitions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricDefinitions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MetricDefinitions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricDefinitions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinitions.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinitions.cs new file mode 100644 index 000000000000..a33557916200 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricDefinitions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Developer.LoadTesting +{ + /// Represents collection of metric definitions. + public partial class MetricDefinitions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// the values for the metric definitions. + /// is null. + internal MetricDefinitions(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// the values for the metric definitions. + /// Keeps track of any properties unknown to the library. + internal MetricDefinitions(IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MetricDefinitions() + { + } + + /// the values for the metric definitions. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespace.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespace.Serialization.cs new file mode 100644 index 000000000000..dcdb9e98ba0d --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespace.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class MetricNamespace : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricNamespace)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MetricNamespace IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricNamespace)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricNamespace(document.RootElement, options); + } + + internal static MetricNamespace DeserializeMetricNamespace(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetricNamespace(description, name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MetricNamespace)} does not support writing '{options.Format}' format."); + } + } + + MetricNamespace IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricNamespace(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricNamespace)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MetricNamespace FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricNamespace(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespace.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespace.cs new file mode 100644 index 000000000000..538d30c5e7bc --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespace.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Metric namespace class specifies the metadata for a metric namespace. + public partial class MetricNamespace + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MetricNamespace() + { + } + + /// Initializes a new instance of . + /// The namespace description. + /// The metric namespace name. + /// Keeps track of any properties unknown to the library. + internal MetricNamespace(string description, string name, IDictionary serializedAdditionalRawData) + { + Description = description; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The namespace description. + public string Description { get; } + /// The metric namespace name. + public string Name { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespaces.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespaces.Serialization.cs new file mode 100644 index 000000000000..8ddba7ae654e --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespaces.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class MetricNamespaces : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricNamespaces)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MetricNamespaces IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricNamespaces)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricNamespaces(document.RootElement, options); + } + + internal static MetricNamespaces DeserializeMetricNamespaces(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricNamespace.DeserializeMetricNamespace(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetricNamespaces(value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MetricNamespaces)} does not support writing '{options.Format}' format."); + } + } + + MetricNamespaces IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricNamespaces(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricNamespaces)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MetricNamespaces FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricNamespaces(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespaces.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespaces.cs new file mode 100644 index 000000000000..f9f84c02c45d --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricNamespaces.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Developer.LoadTesting +{ + /// Represents collection of metric namespaces. + public partial class MetricNamespaces + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The values for the metric namespaces. + /// is null. + internal MetricNamespaces(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The values for the metric namespaces. + /// Keeps track of any properties unknown to the library. + internal MetricNamespaces(IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MetricNamespaces() + { + } + + /// The values for the metric namespaces. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricUnit.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricUnit.cs new file mode 100644 index 000000000000..d64f0709ccd2 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricUnit.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Metric unit. + public readonly partial struct MetricUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MetricUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string PercentValue = "Percent"; + private const string CountValue = "Count"; + private const string SecondsValue = "Seconds"; + private const string MillisecondsValue = "Milliseconds"; + private const string BytesValue = "Bytes"; + private const string BytesPerSecondValue = "BytesPerSecond"; + private const string CountPerSecondValue = "CountPerSecond"; + + /// No unit specified. + public static MetricUnit NotSpecified { get; } = new MetricUnit(NotSpecifiedValue); + /// Percentage. + public static MetricUnit Percent { get; } = new MetricUnit(PercentValue); + /// Value count. + public static MetricUnit Count { get; } = new MetricUnit(CountValue); + /// Seconds. + public static MetricUnit Seconds { get; } = new MetricUnit(SecondsValue); + /// Milliseconds. + public static MetricUnit Milliseconds { get; } = new MetricUnit(MillisecondsValue); + /// Bytes. + public static MetricUnit Bytes { get; } = new MetricUnit(BytesValue); + /// Bytes per second. + public static MetricUnit BytesPerSecond { get; } = new MetricUnit(BytesPerSecondValue); + /// Count per second. + public static MetricUnit CountPerSecond { get; } = new MetricUnit(CountPerSecondValue); + /// Determines if two values are the same. + public static bool operator ==(MetricUnit left, MetricUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MetricUnit left, MetricUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MetricUnit(string value) => new MetricUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MetricUnit other && Equals(other); + /// + public bool Equals(MetricUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricValue.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricValue.Serialization.cs new file mode 100644 index 000000000000..79c825d7b725 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricValue.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class MetricValue : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricValue)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MetricValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricValue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricValue(document.RootElement, options); + } + + internal static MetricValue DeserializeMetricValue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? timestamp = default; + double? value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetricValue(timestamp, value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MetricValue)} does not support writing '{options.Format}' format."); + } + } + + MetricValue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricValue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricValue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MetricValue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricValue(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricValue.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricValue.cs new file mode 100644 index 000000000000..e82fbc986e03 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricValue.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Represents a metric value. + public partial class MetricValue + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MetricValue() + { + } + + /// Initializes a new instance of . + /// The timestamp for the metric value in RFC 3339 format. + /// The metric value. + /// Keeps track of any properties unknown to the library. + internal MetricValue(DateTimeOffset? timestamp, double? value, IDictionary serializedAdditionalRawData) + { + Timestamp = timestamp; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The timestamp for the metric value in RFC 3339 format. + public DateTimeOffset? Timestamp { get; } + /// The metric value. + public double? Value { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricsFilters.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricsFilters.Serialization.cs new file mode 100644 index 000000000000..f2f0c9253e5c --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricsFilters.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class MetricsFilters : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricsFilters)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteStartArray(); + foreach (var item in Filters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MetricsFilters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricsFilters)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricsFilters(document.RootElement, options); + } + + internal static MetricsFilters DeserializeMetricsFilters(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList filters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DimensionFilter.DeserializeDimensionFilter(item, options)); + } + filters = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetricsFilters(filters ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MetricsFilters)} does not support writing '{options.Format}' format."); + } + } + + MetricsFilters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricsFilters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricsFilters)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MetricsFilters FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMetricsFilters(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricsFilters.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricsFilters.cs new file mode 100644 index 000000000000..b31007e96aef --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/MetricsFilters.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Filters to fetch the set of metric. + public partial class MetricsFilters + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public MetricsFilters() + { + Filters = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// Get metrics for specific dimension values. Example: Metric contains dimension + /// like SamplerName, Error. To retrieve all the time series data where SamplerName + /// is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be + /// {"SamplerName", ["HTTPRequest1", "HTTPRequest2"} + /// + /// Keeps track of any properties unknown to the library. + internal MetricsFilters(IList filters, IDictionary serializedAdditionalRawData) + { + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// Get metrics for specific dimension values. Example: Metric contains dimension + /// like SamplerName, Error. To retrieve all the time series data where SamplerName + /// is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be + /// {"SamplerName", ["HTTPRequest1", "HTTPRequest2"} + /// + public IList Filters { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/NameAndDescription.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/NameAndDescription.Serialization.cs new file mode 100644 index 000000000000..eed14d39d2f2 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/NameAndDescription.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class NameAndDescription : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NameAndDescription)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NameAndDescription IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NameAndDescription)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNameAndDescription(document.RootElement, options); + } + + internal static NameAndDescription DeserializeNameAndDescription(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NameAndDescription(description, name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NameAndDescription)} does not support writing '{options.Format}' format."); + } + } + + NameAndDescription IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNameAndDescription(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NameAndDescription)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NameAndDescription FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNameAndDescription(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/NameAndDescription.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/NameAndDescription.cs new file mode 100644 index 000000000000..3669d22e4369 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/NameAndDescription.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// The name and description. + public partial class NameAndDescription + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal NameAndDescription() + { + } + + /// Initializes a new instance of . + /// The description. + /// The name. + /// Keeps track of any properties unknown to the library. + internal NameAndDescription(string description, string name, IDictionary serializedAdditionalRawData) + { + Description = description; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The description. + public string Description { get; } + /// The name. + public string Name { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/OptionalLoadTestConfiguration.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/OptionalLoadTestConfiguration.Serialization.cs new file mode 100644 index 000000000000..f737023a0216 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/OptionalLoadTestConfiguration.Serialization.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class OptionalLoadTestConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OptionalLoadTestConfiguration)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(EndpointUri)) + { + writer.WritePropertyName("endpointUrl"u8); + writer.WriteStringValue(EndpointUri.AbsoluteUri); + } + if (Optional.IsDefined(RequestsPerSecond)) + { + writer.WritePropertyName("requestsPerSecond"u8); + writer.WriteNumberValue(RequestsPerSecond.Value); + } + if (Optional.IsDefined(MaxResponseTimeInMs)) + { + writer.WritePropertyName("maxResponseTimeInMs"u8); + writer.WriteNumberValue(MaxResponseTimeInMs.Value); + } + if (Optional.IsDefined(VirtualUsers)) + { + writer.WritePropertyName("virtualUsers"u8); + writer.WriteNumberValue(VirtualUsers.Value); + } + if (Optional.IsDefined(RampUpTime)) + { + writer.WritePropertyName("rampUpTime"u8); + writer.WriteNumberValue(RampUpTime.Value); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteNumberValue(Convert.ToInt32(Duration.Value.ToString("%s"))); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OptionalLoadTestConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OptionalLoadTestConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOptionalLoadTestConfiguration(document.RootElement, options); + } + + internal static OptionalLoadTestConfiguration DeserializeOptionalLoadTestConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri endpointUrl = default; + int? requestsPerSecond = default; + int? maxResponseTimeInMs = default; + int? virtualUsers = default; + int? rampUpTime = default; + TimeSpan? duration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endpointUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpointUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("requestsPerSecond"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestsPerSecond = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxResponseTimeInMs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxResponseTimeInMs = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("virtualUsers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualUsers = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampUpTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpTime = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("duration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = TimeSpan.FromSeconds(property.Value.GetInt32()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OptionalLoadTestConfiguration( + endpointUrl, + requestsPerSecond, + maxResponseTimeInMs, + virtualUsers, + rampUpTime, + duration, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OptionalLoadTestConfiguration)} does not support writing '{options.Format}' format."); + } + } + + OptionalLoadTestConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOptionalLoadTestConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OptionalLoadTestConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OptionalLoadTestConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOptionalLoadTestConfiguration(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/OptionalLoadTestConfiguration.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/OptionalLoadTestConfiguration.cs new file mode 100644 index 000000000000..1fe5782307a2 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/OptionalLoadTestConfiguration.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Configuration for quick load test. + public partial class OptionalLoadTestConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public OptionalLoadTestConfiguration() + { + } + + /// Initializes a new instance of . + /// Test URL. Provide the complete HTTP URL. For example, https://contoso-app.azurewebsites.net/login. + /// Target throughput (requests per second). This may not be necessarily achieved. The actual throughput will be lower if the application is not capable of handling it. + /// Maximum response time in milliseconds of the API/endpoint. + /// No of concurrent virtual users. + /// Ramp up time in seconds. + /// Test run duration in seconds. + /// Keeps track of any properties unknown to the library. + internal OptionalLoadTestConfiguration(Uri endpointUri, int? requestsPerSecond, int? maxResponseTimeInMs, int? virtualUsers, int? rampUpTime, TimeSpan? duration, IDictionary serializedAdditionalRawData) + { + EndpointUri = endpointUri; + RequestsPerSecond = requestsPerSecond; + MaxResponseTimeInMs = maxResponseTimeInMs; + VirtualUsers = virtualUsers; + RampUpTime = rampUpTime; + Duration = duration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Test URL. Provide the complete HTTP URL. For example, https://contoso-app.azurewebsites.net/login. + public Uri EndpointUri { get; set; } + /// Target throughput (requests per second). This may not be necessarily achieved. The actual throughput will be lower if the application is not capable of handling it. + public int? RequestsPerSecond { get; set; } + /// Maximum response time in milliseconds of the API/endpoint. + public int? MaxResponseTimeInMs { get; set; } + /// No of concurrent virtual users. + public int? VirtualUsers { get; set; } + /// Ramp up time in seconds. + public int? RampUpTime { get; set; } + /// Test run duration in seconds. + public TimeSpan? Duration { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailAction.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailAction.cs new file mode 100644 index 000000000000..15672f674687 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailAction.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Action to take on failure of pass/fail criteria. + public readonly partial struct PassFailAction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PassFailAction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ContinueValue = "continue"; + private const string StopValue = "stop"; + + /// Test will continue to run even if pass fail metric criteria metric gets failed. + public static PassFailAction Continue { get; } = new PassFailAction(ContinueValue); + /// Test run will stop if pass fail criteria metric is not passed. + public static PassFailAction Stop { get; } = new PassFailAction(StopValue); + /// Determines if two values are the same. + public static bool operator ==(PassFailAction left, PassFailAction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PassFailAction left, PassFailAction right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PassFailAction(string value) => new PassFailAction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PassFailAction other && Equals(other); + /// + public bool Equals(PassFailAction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailAggregationFunction.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailAggregationFunction.cs new file mode 100644 index 000000000000..bec34915adcb --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailAggregationFunction.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Aggregation functions for pass/fail criteria. + public readonly partial struct PassFailAggregationFunction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PassFailAggregationFunction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CountValue = "count"; + private const string PercentageValue = "percentage"; + private const string AverageValue = "avg"; + private const string Percentile50Value = "p50"; + private const string Percentile75Value = "p75"; + private const string Percentile90Value = "p90"; + private const string Percentile95Value = "p95"; + private const string Percentile96Value = "p96"; + private const string Percentile97Value = "p97"; + private const string Percentile98Value = "p98"; + private const string Percentile99Value = "p99"; + private const string Percentile999Value = "p99.9"; + private const string Percentile9999Value = "p99.99"; + private const string MinimumValue = "min"; + private const string MaximumValue = "max"; + + /// Criteria applies for count value. + public static PassFailAggregationFunction Count { get; } = new PassFailAggregationFunction(CountValue); + /// Criteria applies for given percentage value. + public static PassFailAggregationFunction Percentage { get; } = new PassFailAggregationFunction(PercentageValue); + /// Criteria applies for avg value. + public static PassFailAggregationFunction Average { get; } = new PassFailAggregationFunction(AverageValue); + /// Criteria applies for 50th percentile value. + public static PassFailAggregationFunction Percentile50 { get; } = new PassFailAggregationFunction(Percentile50Value); + /// Criteria applies for 75th percentile value. + public static PassFailAggregationFunction Percentile75 { get; } = new PassFailAggregationFunction(Percentile75Value); + /// Criteria applies for 90th percentile value. + public static PassFailAggregationFunction Percentile90 { get; } = new PassFailAggregationFunction(Percentile90Value); + /// Criteria applies for 95th percentile value. + public static PassFailAggregationFunction Percentile95 { get; } = new PassFailAggregationFunction(Percentile95Value); + /// Criteria applies for 96th percentile value. + public static PassFailAggregationFunction Percentile96 { get; } = new PassFailAggregationFunction(Percentile96Value); + /// Criteria applies for 97th percentile value. + public static PassFailAggregationFunction Percentile97 { get; } = new PassFailAggregationFunction(Percentile97Value); + /// Criteria applies for 98th percentile value. + public static PassFailAggregationFunction Percentile98 { get; } = new PassFailAggregationFunction(Percentile98Value); + /// Criteria applies for 99th percentile value. + public static PassFailAggregationFunction Percentile99 { get; } = new PassFailAggregationFunction(Percentile99Value); + /// Criteria applies for 99.9th percentile value. + public static PassFailAggregationFunction Percentile999 { get; } = new PassFailAggregationFunction(Percentile999Value); + /// Criteria applies for 99.99th percentile value. + public static PassFailAggregationFunction Percentile9999 { get; } = new PassFailAggregationFunction(Percentile9999Value); + /// Criteria applies for minimum value. + public static PassFailAggregationFunction Minimum { get; } = new PassFailAggregationFunction(MinimumValue); + /// Criteria applies for maximum value. + public static PassFailAggregationFunction Maximum { get; } = new PassFailAggregationFunction(MaximumValue); + /// Determines if two values are the same. + public static bool operator ==(PassFailAggregationFunction left, PassFailAggregationFunction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PassFailAggregationFunction left, PassFailAggregationFunction right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PassFailAggregationFunction(string value) => new PassFailAggregationFunction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PassFailAggregationFunction other && Equals(other); + /// + public bool Equals(PassFailAggregationFunction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailCriteria.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailCriteria.Serialization.cs new file mode 100644 index 000000000000..60e90b9d81a9 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailCriteria.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class PassFailCriteria : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PassFailCriteria)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(PassFailMetrics)) + { + writer.WritePropertyName("passFailMetrics"u8); + writer.WriteStartObject(); + foreach (var item in PassFailMetrics) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(PassFailServerMetrics)) + { + writer.WritePropertyName("passFailServerMetrics"u8); + writer.WriteStartObject(); + foreach (var item in PassFailServerMetrics) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PassFailCriteria IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PassFailCriteria)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePassFailCriteria(document.RootElement, options); + } + + internal static PassFailCriteria DeserializePassFailCriteria(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary passFailMetrics = default; + IDictionary passFailServerMetrics = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("passFailMetrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, PassFailMetric.DeserializePassFailMetric(property0.Value, options)); + } + passFailMetrics = dictionary; + continue; + } + if (property.NameEquals("passFailServerMetrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, PassFailServerMetric.DeserializePassFailServerMetric(property0.Value, options)); + } + passFailServerMetrics = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PassFailCriteria(passFailMetrics ?? new ChangeTrackingDictionary(), passFailServerMetrics ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PassFailCriteria)} does not support writing '{options.Format}' format."); + } + } + + PassFailCriteria IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePassFailCriteria(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PassFailCriteria)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PassFailCriteria FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePassFailCriteria(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailCriteria.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailCriteria.cs new file mode 100644 index 000000000000..f2dc32a480e5 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailCriteria.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Pass fail criteria for a test. + public partial class PassFailCriteria + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PassFailCriteria() + { + PassFailMetrics = new ChangeTrackingDictionary(); + PassFailServerMetrics = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Map of id and pass fail metrics { id : pass fail metrics }. + /// Map of id and pass fail server metrics { id : pass fail metrics }. + /// Keeps track of any properties unknown to the library. + internal PassFailCriteria(IDictionary passFailMetrics, IDictionary passFailServerMetrics, IDictionary serializedAdditionalRawData) + { + PassFailMetrics = passFailMetrics; + PassFailServerMetrics = passFailServerMetrics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Map of id and pass fail metrics { id : pass fail metrics }. + public IDictionary PassFailMetrics { get; } + /// Map of id and pass fail server metrics { id : pass fail metrics }. + public IDictionary PassFailServerMetrics { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailMetric.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailMetric.Serialization.cs new file mode 100644 index 000000000000..9daf80f84e05 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailMetric.Serialization.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class PassFailMetric : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PassFailMetric)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ClientMetric)) + { + writer.WritePropertyName("clientMetric"u8); + writer.WriteStringValue(ClientMetric.Value.ToString()); + } + if (Optional.IsDefined(Aggregate)) + { + writer.WritePropertyName("aggregate"u8); + writer.WriteStringValue(Aggregate.Value.ToString()); + } + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (Optional.IsDefined(RequestName)) + { + writer.WritePropertyName("requestName"u8); + writer.WriteStringValue(RequestName); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ActualValue)) + { + writer.WritePropertyName("actualValue"u8); + writer.WriteNumberValue(ActualValue.Value); + } + if (options.Format != "W" && Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteStringValue(Result.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PassFailMetric IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PassFailMetric)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePassFailMetric(document.RootElement, options); + } + + internal static PassFailMetric DeserializePassFailMetric(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PfMetrics? clientMetric = default; + PassFailAggregationFunction? aggregate = default; + string condition = default; + string requestName = default; + double? value = default; + PassFailAction? action = default; + double? actualValue = default; + PassFailResult? result = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientMetric"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientMetric = new PfMetrics(property.Value.GetString()); + continue; + } + if (property.NameEquals("aggregate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aggregate = new PassFailAggregationFunction(property.Value.GetString()); + continue; + } + if (property.NameEquals("condition"u8)) + { + condition = property.Value.GetString(); + continue; + } + if (property.NameEquals("requestName"u8)) + { + requestName = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("action"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + action = new PassFailAction(property.Value.GetString()); + continue; + } + if (property.NameEquals("actualValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actualValue = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = new PassFailResult(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PassFailMetric( + clientMetric, + aggregate, + condition, + requestName, + value, + action, + actualValue, + result, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PassFailMetric)} does not support writing '{options.Format}' format."); + } + } + + PassFailMetric IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePassFailMetric(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PassFailMetric)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PassFailMetric FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePassFailMetric(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailMetric.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailMetric.cs new file mode 100644 index 000000000000..623cd825a9d1 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailMetric.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Pass fail metric. + public partial class PassFailMetric + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PassFailMetric() + { + } + + /// Initializes a new instance of . + /// The client metric on which the criteria should be applied. + /// + /// The aggregation function to be applied on the client metric. Allowed functions + /// - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, + /// ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + /// ‘count’ - for requests + /// + /// The comparison operator. Supported types ‘>’, ‘<’. + /// Request name for which the Pass fail criteria has to be applied. + /// + /// The value to compare with the client metric. Allowed values - ‘error : [0.0 , + /// 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + /// + /// Action taken after the threshold is met. Default is ‘continue’. + /// The actual value of the client metric for the test run. + /// Outcome of the test run. + /// Keeps track of any properties unknown to the library. + internal PassFailMetric(PfMetrics? clientMetric, PassFailAggregationFunction? aggregate, string condition, string requestName, double? value, PassFailAction? action, double? actualValue, PassFailResult? result, IDictionary serializedAdditionalRawData) + { + ClientMetric = clientMetric; + Aggregate = aggregate; + Condition = condition; + RequestName = requestName; + Value = value; + Action = action; + ActualValue = actualValue; + Result = result; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The client metric on which the criteria should be applied. + public PfMetrics? ClientMetric { get; set; } + /// + /// The aggregation function to be applied on the client metric. Allowed functions + /// - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, + /// ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + /// ‘count’ - for requests + /// + public PassFailAggregationFunction? Aggregate { get; set; } + /// The comparison operator. Supported types ‘>’, ‘<’. + public string Condition { get; set; } + /// Request name for which the Pass fail criteria has to be applied. + public string RequestName { get; set; } + /// + /// The value to compare with the client metric. Allowed values - ‘error : [0.0 , + /// 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + /// + public double? Value { get; set; } + /// Action taken after the threshold is met. Default is ‘continue’. + public PassFailAction? Action { get; set; } + /// The actual value of the client metric for the test run. + public double? ActualValue { get; } + /// Outcome of the test run. + public PassFailResult? Result { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailResult.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailResult.cs new file mode 100644 index 000000000000..322a04ecded0 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailResult.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Pass/fail criteria result. + public readonly partial struct PassFailResult : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PassFailResult(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PassedValue = "passed"; + private const string UndeterminedValue = "undetermined"; + private const string FailedValue = "failed"; + + /// Given pass fail criteria metric has passed. + public static PassFailResult Passed { get; } = new PassFailResult(PassedValue); + /// Given pass fail criteria metric couldn't determine. + public static PassFailResult Undetermined { get; } = new PassFailResult(UndeterminedValue); + /// Given pass fail criteria metric has failed. + public static PassFailResult Failed { get; } = new PassFailResult(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(PassFailResult left, PassFailResult right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PassFailResult left, PassFailResult right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PassFailResult(string value) => new PassFailResult(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PassFailResult other && Equals(other); + /// + public bool Equals(PassFailResult other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailServerMetric.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailServerMetric.Serialization.cs new file mode 100644 index 000000000000..7345fc91d6f4 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailServerMetric.Serialization.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class PassFailServerMetric : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PassFailServerMetric)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + writer.WritePropertyName("metricNamespace"u8); + writer.WriteStringValue(MetricNamespace); + writer.WritePropertyName("metricName"u8); + writer.WriteStringValue(MetricName); + writer.WritePropertyName("aggregation"u8); + writer.WriteStringValue(Aggregation); + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ActualValue)) + { + writer.WritePropertyName("actualValue"u8); + writer.WriteNumberValue(ActualValue.Value); + } + if (options.Format != "W" && Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteStringValue(Result.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PassFailServerMetric IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PassFailServerMetric)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePassFailServerMetric(document.RootElement, options); + } + + internal static PassFailServerMetric DeserializePassFailServerMetric(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier resourceId = default; + string metricNamespace = default; + string metricName = default; + string aggregation = default; + string condition = default; + double value = default; + PassFailAction? action = default; + double? actualValue = default; + PassFailResult? result = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("metricNamespace"u8)) + { + metricNamespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("metricName"u8)) + { + metricName = property.Value.GetString(); + continue; + } + if (property.NameEquals("aggregation"u8)) + { + aggregation = property.Value.GetString(); + continue; + } + if (property.NameEquals("condition"u8)) + { + condition = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("action"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + action = new PassFailAction(property.Value.GetString()); + continue; + } + if (property.NameEquals("actualValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actualValue = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = new PassFailResult(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PassFailServerMetric( + resourceId, + metricNamespace, + metricName, + aggregation, + condition, + value, + action, + actualValue, + result, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PassFailServerMetric)} does not support writing '{options.Format}' format."); + } + } + + PassFailServerMetric IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePassFailServerMetric(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PassFailServerMetric)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PassFailServerMetric FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePassFailServerMetric(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailServerMetric.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailServerMetric.cs new file mode 100644 index 000000000000..e595efde037e --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailServerMetric.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// Pass fail server metric. + public partial class PassFailServerMetric + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The resource id of the resource emitting the metric. + /// The server metric namespace. + /// The server metric name. + /// Aggregation Type. + /// The comparison operator. Supported types ‘>’, ‘<’. + /// The value to compare with the server metric. + /// , , , or is null. + public PassFailServerMetric(ResourceIdentifier resourceId, string metricNamespace, string metricName, string aggregation, string condition, double value) + { + Argument.AssertNotNull(resourceId, nameof(resourceId)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(metricName, nameof(metricName)); + Argument.AssertNotNull(aggregation, nameof(aggregation)); + Argument.AssertNotNull(condition, nameof(condition)); + + ResourceId = resourceId; + MetricNamespace = metricNamespace; + MetricName = metricName; + Aggregation = aggregation; + Condition = condition; + Value = value; + } + + /// Initializes a new instance of . + /// The resource id of the resource emitting the metric. + /// The server metric namespace. + /// The server metric name. + /// Aggregation Type. + /// The comparison operator. Supported types ‘>’, ‘<’. + /// The value to compare with the server metric. + /// Action taken after the threshold is met. Default is ‘continue’. + /// The actual value of the server metric. + /// Outcome of the test run. + /// Keeps track of any properties unknown to the library. + internal PassFailServerMetric(ResourceIdentifier resourceId, string metricNamespace, string metricName, string aggregation, string condition, double value, PassFailAction? action, double? actualValue, PassFailResult? result, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + MetricNamespace = metricNamespace; + MetricName = metricName; + Aggregation = aggregation; + Condition = condition; + Value = value; + Action = action; + ActualValue = actualValue; + Result = result; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PassFailServerMetric() + { + } + + /// The resource id of the resource emitting the metric. + public ResourceIdentifier ResourceId { get; set; } + /// The server metric namespace. + public string MetricNamespace { get; set; } + /// The server metric name. + public string MetricName { get; set; } + /// Aggregation Type. + public string Aggregation { get; set; } + /// The comparison operator. Supported types ‘>’, ‘<’. + public string Condition { get; set; } + /// The value to compare with the server metric. + public double Value { get; set; } + /// Action taken after the threshold is met. Default is ‘continue’. + public PassFailAction? Action { get; set; } + /// The actual value of the server metric. + public double? ActualValue { get; } + /// Outcome of the test run. + public PassFailResult? Result { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailTestResult.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailTestResult.cs new file mode 100644 index 000000000000..9e9ba8dcff58 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PassFailTestResult.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Test result based on pass/fail criteria. + public readonly partial struct PassFailTestResult : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PassFailTestResult(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PASSEDValue = "PASSED"; + private const string NOTAPPLICABLEValue = "NOT_APPLICABLE"; + private const string FAILEDValue = "FAILED"; + + /// Pass/fail criteria has passed. + public static PassFailTestResult PASSED { get; } = new PassFailTestResult(PASSEDValue); + /// Pass/fail criteria is not applicable. + public static PassFailTestResult NOTAPPLICABLE { get; } = new PassFailTestResult(NOTAPPLICABLEValue); + /// Pass/fail criteria has failed. + public static PassFailTestResult FAILED { get; } = new PassFailTestResult(FAILEDValue); + /// Determines if two values are the same. + public static bool operator ==(PassFailTestResult left, PassFailTestResult right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PassFailTestResult left, PassFailTestResult right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PassFailTestResult(string value) => new PassFailTestResult(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PassFailTestResult other && Equals(other); + /// + public bool Equals(PassFailTestResult other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PfMetrics.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PfMetrics.cs new file mode 100644 index 000000000000..cd959571727a --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/PfMetrics.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Metrics for pass/fail criteria. + public readonly partial struct PfMetrics : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PfMetrics(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ResponseTimeInMillisecondsValue = "response_time_ms"; + private const string LatencyValue = "latency"; + private const string ErrorValue = "error"; + private const string RequestsValue = "requests"; + private const string RequestsPerSecondValue = "requests_per_sec"; + + /// Pass fail criteria for response time metric in milliseconds. + public static PfMetrics ResponseTimeInMilliseconds { get; } = new PfMetrics(ResponseTimeInMillisecondsValue); + /// Pass fail criteria for latency metric in milliseconds. + public static PfMetrics Latency { get; } = new PfMetrics(LatencyValue); + /// Pass fail criteria for error metric. + public static PfMetrics Error { get; } = new PfMetrics(ErrorValue); + /// Pass fail criteria for total requests. + public static PfMetrics Requests { get; } = new PfMetrics(RequestsValue); + /// Pass fail criteria for request per second. + public static PfMetrics RequestsPerSecond { get; } = new PfMetrics(RequestsPerSecondValue); + /// Determines if two values are the same. + public static bool operator ==(PfMetrics left, PfMetrics right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PfMetrics left, PfMetrics right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PfMetrics(string value) => new PfMetrics(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PfMetrics other && Equals(other); + /// + public bool Equals(PfMetrics other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RecommendationCategory.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RecommendationCategory.cs new file mode 100644 index 000000000000..588b050d7070 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RecommendationCategory.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Category of Recommendation. + public readonly partial struct RecommendationCategory : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RecommendationCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ThroughputOptimizedValue = "ThroughputOptimized"; + private const string CostOptimizedValue = "CostOptimized"; + + /// The recommendation for this category optimizes the throughput/RPS (Requests per Second) of the app. + public static RecommendationCategory ThroughputOptimized { get; } = new RecommendationCategory(ThroughputOptimizedValue); + /// The recommendation for this category optimizes the cost of the app. + public static RecommendationCategory CostOptimized { get; } = new RecommendationCategory(CostOptimizedValue); + /// Determines if two values are the same. + public static bool operator ==(RecommendationCategory left, RecommendationCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RecommendationCategory left, RecommendationCategory right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RecommendationCategory(string value) => new RecommendationCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RecommendationCategory other && Equals(other); + /// + public bool Equals(RecommendationCategory other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RegionalConfiguration.Serialization.cs similarity index 59% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs rename to sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RegionalConfiguration.Serialization.cs index fe769e9deb54..a24d632ffe3a 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RegionalConfiguration.Serialization.cs @@ -11,13 +11,13 @@ using System.Text.Json; using Azure.Core; -namespace Azure.AI.Vision.Face +namespace Azure.Developer.LoadTesting { - public partial class LivenessOutputsTarget : IUtf8JsonSerializable, IJsonModel + public partial class RegionalConfiguration : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,20 +28,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RegionalConfiguration)} does not support writing '{format}' format."); } - writer.WritePropertyName("faceRectangle"u8); - writer.WriteObjectValue(FaceRectangle, options); - writer.WritePropertyName("fileName"u8); - writer.WriteStringValue(FileName); - writer.WritePropertyName("timeOffsetWithinFile"u8); - writer.WriteNumberValue(TimeOffsetWithinFile); - writer.WritePropertyName("imageType"u8); - writer.WriteStringValue(ImageType.ToString()); + writer.WritePropertyName("engineInstances"u8); + writer.WriteNumberValue(EngineInstances); + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -59,19 +55,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessOutputsTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RegionalConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RegionalConfiguration)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessOutputsTarget(document.RootElement, options); + return DeserializeRegionalConfiguration(document.RootElement, options); } - internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonElement element, ModelReaderWriterOptions options = null) + internal static RegionalConfiguration DeserializeRegionalConfiguration(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -79,32 +75,20 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme { return null; } - FaceRectangle faceRectangle = default; - string fileName = default; - int timeOffsetWithinFile = default; - FaceImageType imageType = default; + int engineInstances = default; + AzureLocation region = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("faceRectangle"u8)) + if (property.NameEquals("engineInstances"u8)) { - faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); + engineInstances = property.Value.GetInt32(); continue; } - if (property.NameEquals("fileName"u8)) + if (property.NameEquals("region"u8)) { - fileName = property.Value.GetString(); - continue; - } - if (property.NameEquals("timeOffsetWithinFile"u8)) - { - timeOffsetWithinFile = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("imageType"u8)) - { - imageType = new FaceImageType(property.Value.GetString()); + region = new AzureLocation(property.Value.GetString()); continue; } if (options.Format != "W") @@ -113,46 +97,46 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, serializedAdditionalRawData); + return new RegionalConfiguration(engineInstances, region, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RegionalConfiguration)} does not support writing '{options.Format}' format."); } } - LivenessOutputsTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RegionalConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessOutputsTarget(document.RootElement, options); + return DeserializeRegionalConfiguration(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RegionalConfiguration)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessOutputsTarget FromResponse(Response response) + internal static RegionalConfiguration FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessOutputsTarget(document.RootElement); + return DeserializeRegionalConfiguration(document.RootElement); } /// Convert into a . diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RegionalConfiguration.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RegionalConfiguration.cs new file mode 100644 index 000000000000..fd742c09e86f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RegionalConfiguration.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// Region distribution configuration for the load test. + public partial class RegionalConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The number of engine instances to execute load test in specified region. Supported values are in range of 1-400. + /// + /// Azure region name. + /// The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For example, East US should be passed as "eastus". + /// The region name must match one of the strings in the "Name" column returned from running the "az account list-locations -o table" Azure CLI command. + /// + public RegionalConfiguration(int engineInstances, AzureLocation region) + { + EngineInstances = engineInstances; + Region = region; + } + + /// Initializes a new instance of . + /// The number of engine instances to execute load test in specified region. Supported values are in range of 1-400. + /// + /// Azure region name. + /// The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For example, East US should be passed as "eastus". + /// The region name must match one of the strings in the "Name" column returned from running the "az account list-locations -o table" Azure CLI command. + /// + /// Keeps track of any properties unknown to the library. + internal RegionalConfiguration(int engineInstances, AzureLocation region, IDictionary serializedAdditionalRawData) + { + EngineInstances = engineInstances; + Region = region; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RegionalConfiguration() + { + } + + /// The number of engine instances to execute load test in specified region. Supported values are in range of 1-400. + public int EngineInstances { get; set; } + /// + /// Azure region name. + /// The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For example, East US should be passed as "eastus". + /// The region name must match one of the strings in the "Name" column returned from running the "az account list-locations -o table" Azure CLI command. + /// + public AzureLocation Region { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RequestDataLevel.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RequestDataLevel.cs new file mode 100644 index 000000000000..b55aa822172b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/RequestDataLevel.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Request data collection level for test run. + public readonly partial struct RequestDataLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RequestDataLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NONEValue = "NONE"; + private const string ERRORSValue = "ERRORS"; + + /// No request data will be collected. + public static RequestDataLevel NONE { get; } = new RequestDataLevel(NONEValue); + /// Request data will be collected in case of failed requests. + public static RequestDataLevel ERRORS { get; } = new RequestDataLevel(ERRORSValue); + /// Determines if two values are the same. + public static bool operator ==(RequestDataLevel left, RequestDataLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RequestDataLevel left, RequestDataLevel right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RequestDataLevel(string value) => new RequestDataLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RequestDataLevel other && Equals(other); + /// + public bool Equals(RequestDataLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceKind.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceKind.cs new file mode 100644 index 000000000000..10af6895b2ec --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceKind.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Kind of the resource on which test profile is created. + internal readonly partial struct ResourceKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FunctionsFlexConsumptionValue = "FunctionsFlexConsumption"; + + /// Resource is a Azure FunctionApp on Flex Consumption Plan. + public static ResourceKind FunctionsFlexConsumption { get; } = new ResourceKind(FunctionsFlexConsumptionValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceKind left, ResourceKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceKind left, ResourceKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceKind(string value) => new ResourceKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceKind other && Equals(other); + /// + public bool Equals(ResourceKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceMetric.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceMetric.Serialization.cs new file mode 100644 index 000000000000..4c0ed72b3c30 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceMetric.Serialization.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class ResourceMetric : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceMetric)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + writer.WritePropertyName("metricNamespace"u8); + writer.WriteStringValue(MetricNamespace); + if (Optional.IsDefined(DisplayDescription)) + { + writer.WritePropertyName("displayDescription"u8); + writer.WriteStringValue(DisplayDescription); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("aggregation"u8); + writer.WriteStringValue(Aggregation); + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceMetric IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceMetric)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceMetric(document.RootElement, options); + } + + internal static ResourceMetric DeserializeResourceMetric(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + ResourceIdentifier resourceId = default; + string metricNamespace = default; + string displayDescription = default; + string name = default; + string aggregation = default; + string unit = default; + string resourceType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("metricNamespace"u8)) + { + metricNamespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayDescription"u8)) + { + displayDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("aggregation"u8)) + { + aggregation = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + resourceType = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceMetric( + id, + resourceId, + metricNamespace, + displayDescription, + name, + aggregation, + unit, + resourceType, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ResourceMetric)} does not support writing '{options.Format}' format."); + } + } + + ResourceMetric IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceMetric(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceMetric)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ResourceMetric FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceMetric(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceMetric.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceMetric.cs new file mode 100644 index 000000000000..5059dad8af80 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/ResourceMetric.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// + /// Associated metric definition for particular metrics of the azure resource ( + /// Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition). + /// + public partial class ResourceMetric + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Azure resource id. + /// Metric name space. + /// The invariant value of metric name. + /// Metric aggregation. + /// Azure resource type. + /// , , , or is null. + public ResourceMetric(ResourceIdentifier resourceId, string metricNamespace, string name, string aggregation, string resourceType) + { + Argument.AssertNotNull(resourceId, nameof(resourceId)); + Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(aggregation, nameof(aggregation)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + ResourceId = resourceId; + MetricNamespace = metricNamespace; + Name = name; + Aggregation = aggregation; + ResourceType = resourceType; + } + + /// Initializes a new instance of . + /// Unique name for metric. + /// Azure resource id. + /// Metric name space. + /// Metric description. + /// The invariant value of metric name. + /// Metric aggregation. + /// Metric unit. + /// Azure resource type. + /// Keeps track of any properties unknown to the library. + internal ResourceMetric(string id, ResourceIdentifier resourceId, string metricNamespace, string displayDescription, string name, string aggregation, string unit, string resourceType, IDictionary serializedAdditionalRawData) + { + Id = id; + ResourceId = resourceId; + MetricNamespace = metricNamespace; + DisplayDescription = displayDescription; + Name = name; + Aggregation = aggregation; + Unit = unit; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceMetric() + { + } + + /// Unique name for metric. + public string Id { get; } + /// Azure resource id. + public ResourceIdentifier ResourceId { get; set; } + /// Metric name space. + public string MetricNamespace { get; set; } + /// Metric description. + public string DisplayDescription { get; set; } + /// The invariant value of metric name. + public string Name { get; set; } + /// Metric aggregation. + public string Aggregation { get; set; } + /// Metric unit. + public string Unit { get; set; } + /// Azure resource type. + public string ResourceType { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/SecretType.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/SecretType.cs new file mode 100644 index 000000000000..6937c671909b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/SecretType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Types of secrets supported. + public readonly partial struct SecretType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SecretType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string KeyVaultSecretUriValue = "AKV_SECRET_URI"; + private const string SecretValueValue = "SECRET_VALUE"; + + /// If the secret is stored in an Azure Key Vault. + public static SecretType KeyVaultSecretUri { get; } = new SecretType(KeyVaultSecretUriValue); + /// If the secret value provided as plain text. + public static SecretType SecretValue { get; } = new SecretType(SecretValueValue); + /// Determines if two values are the same. + public static bool operator ==(SecretType left, SecretType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SecretType left, SecretType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SecretType(string value) => new SecretType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SecretType other && Equals(other); + /// + public bool Equals(SecretType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TargetResourceConfigurations.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TargetResourceConfigurations.Serialization.cs new file mode 100644 index 000000000000..bf25b7a5c885 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TargetResourceConfigurations.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + [PersistableModelProxy(typeof(UnknownTargetResourceConfigurations))] + public partial class TargetResourceConfigurations : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TargetResourceConfigurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetResourceConfigurations(document.RootElement, options); + } + + internal static TargetResourceConfigurations DeserializeTargetResourceConfigurations(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "FunctionsFlexConsumption": return FunctionFlexConsumptionTargetResourceConfigurations.DeserializeFunctionFlexConsumptionTargetResourceConfigurations(element, options); + } + } + return UnknownTargetResourceConfigurations.DeserializeUnknownTargetResourceConfigurations(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support writing '{options.Format}' format."); + } + } + + TargetResourceConfigurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetResourceConfigurations(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TargetResourceConfigurations FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetResourceConfigurations(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TargetResourceConfigurations.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TargetResourceConfigurations.cs new file mode 100644 index 000000000000..653c885e35ba --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TargetResourceConfigurations.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// + /// Configurations of a target resource. This varies with the kind of resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class TargetResourceConfigurations + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected TargetResourceConfigurations() + { + } + + /// Initializes a new instance of . + /// Kind of the resource for which the configurations apply. + /// Keeps track of any properties unknown to the library. + internal TargetResourceConfigurations(ResourceKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Kind of the resource for which the configurations apply. + internal ResourceKind Kind { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestAppComponents.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestAppComponents.Serialization.cs new file mode 100644 index 000000000000..72a8ccda371c --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestAppComponents.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestAppComponents : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestAppComponents)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("components"u8); + writer.WriteStartObject(); + foreach (var item in Components) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + if (options.Format != "W" && Optional.IsDefined(TestId)) + { + writer.WritePropertyName("testId"u8); + writer.WriteStringValue(TestId); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestAppComponents IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestAppComponents)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestAppComponents(document.RootElement, options); + } + + internal static TestAppComponents DeserializeTestAppComponents(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary components = default; + string testId = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("components"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, LoadTestingAppComponent.DeserializeLoadTestingAppComponent(property0.Value, options)); + } + components = dictionary; + continue; + } + if (property.NameEquals("testId"u8)) + { + testId = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestAppComponents( + components, + testId, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestAppComponents)} does not support writing '{options.Format}' format."); + } + } + + TestAppComponents IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestAppComponents(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestAppComponents)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestAppComponents FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestAppComponents(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestAppComponents.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestAppComponents.cs new file mode 100644 index 000000000000..3e7e8a90b428 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestAppComponents.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Test app components. + public partial class TestAppComponents + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + /// is null. + public TestAppComponents(IDictionary components) + { + Argument.AssertNotNull(components, nameof(components)); + + Components = components; + } + + /// Initializes a new instance of . + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + /// Test identifier. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal TestAppComponents(IDictionary components, string testId, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + Components = components; + TestId = testId; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TestAppComponents() + { + } + + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + public IDictionary Components { get; } + /// Test identifier. + public string TestId { get; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestCertificate.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestCertificate.Serialization.cs new file mode 100644 index 000000000000..d496bda39faf --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestCertificate.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestCertificate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestCertificate)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(CertificateKind)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(CertificateKind.Value.ToString()); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestCertificate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestCertificate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestCertificate(document.RootElement, options); + } + + internal static TestCertificate DeserializeTestCertificate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + CertificateType? type = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new CertificateType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestCertificate(value, type, name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestCertificate)} does not support writing '{options.Format}' format."); + } + } + + TestCertificate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestCertificate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestCertificate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestCertificate FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestCertificate(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestCertificate.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestCertificate.cs new file mode 100644 index 000000000000..52ba75d2b6ca --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestCertificate.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Certificates metadata. + public partial class TestCertificate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TestCertificate() + { + } + + /// Initializes a new instance of . + /// The value of the certificate for respective type. + /// Type of certificate. + /// Name of the certificate. + /// Keeps track of any properties unknown to the library. + internal TestCertificate(string value, CertificateType? certificateKind, string name, IDictionary serializedAdditionalRawData) + { + Value = value; + CertificateKind = certificateKind; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The value of the certificate for respective type. + public string Value { get; set; } + /// Type of certificate. + public CertificateType? CertificateKind { get; set; } + /// Name of the certificate. + public string Name { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestFileInfo.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestFileInfo.Serialization.cs new file mode 100644 index 000000000000..55f0ce83a72b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestFileInfo.Serialization.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestFileInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestFileInfo)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("fileName"u8); + writer.WriteStringValue(FileName); + if (options.Format != "W" && Optional.IsDefined(Uri)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (options.Format != "W" && Optional.IsDefined(FileType)) + { + writer.WritePropertyName("fileType"u8); + writer.WriteStringValue(FileType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ExpiresOn)) + { + writer.WritePropertyName("expireDateTime"u8); + writer.WriteStringValue(ExpiresOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ValidationStatus)) + { + writer.WritePropertyName("validationStatus"u8); + writer.WriteStringValue(ValidationStatus.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ValidationFailureDetails)) + { + writer.WritePropertyName("validationFailureDetails"u8); + writer.WriteStringValue(ValidationFailureDetails); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestFileInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestFileInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestFileInfo(document.RootElement, options); + } + + internal static TestFileInfo DeserializeTestFileInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileName = default; + Uri url = default; + LoadTestingFileType? fileType = default; + DateTimeOffset? expireDateTime = default; + FileValidationStatus? validationStatus = default; + string validationFailureDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("fileName"u8)) + { + fileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("url"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + url = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("fileType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileType = new LoadTestingFileType(property.Value.GetString()); + continue; + } + if (property.NameEquals("expireDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expireDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("validationStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationStatus = new FileValidationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("validationFailureDetails"u8)) + { + validationFailureDetails = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestFileInfo( + fileName, + url, + fileType, + expireDateTime, + validationStatus, + validationFailureDetails, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestFileInfo)} does not support writing '{options.Format}' format."); + } + } + + TestFileInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestFileInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestFileInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestFileInfo FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestFileInfo(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestFileInfo.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestFileInfo.cs new file mode 100644 index 000000000000..f8565ac4492c --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestFileInfo.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Test file info. + public partial class TestFileInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the file. + /// is null. + internal TestFileInfo(string fileName) + { + Argument.AssertNotNull(fileName, nameof(fileName)); + + FileName = fileName; + } + + /// Initializes a new instance of . + /// Name of the file. + /// File URL. + /// File type. + /// Expiry time of the file (RFC 3339 literal format). + /// Validation status of the file. + /// Validation failure error details. + /// Keeps track of any properties unknown to the library. + internal TestFileInfo(string fileName, Uri uri, LoadTestingFileType? fileType, DateTimeOffset? expiresOn, FileValidationStatus? validationStatus, string validationFailureDetails, IDictionary serializedAdditionalRawData) + { + FileName = fileName; + Uri = uri; + FileType = fileType; + ExpiresOn = expiresOn; + ValidationStatus = validationStatus; + ValidationFailureDetails = validationFailureDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TestFileInfo() + { + } + + /// Name of the file. + public string FileName { get; } + /// File URL. + public Uri Uri { get; } + /// File type. + public LoadTestingFileType? FileType { get; } + /// Expiry time of the file (RFC 3339 literal format). + public DateTimeOffset? ExpiresOn { get; } + /// Validation status of the file. + public FileValidationStatus? ValidationStatus { get; } + /// Validation failure error details. + public string ValidationFailureDetails { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestInputArtifacts.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestInputArtifacts.Serialization.cs new file mode 100644 index 000000000000..8a4544b32a89 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestInputArtifacts.Serialization.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestInputArtifacts : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestInputArtifacts)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ConfigFileInfo)) + { + writer.WritePropertyName("configFileInfo"u8); + writer.WriteObjectValue(ConfigFileInfo, options); + } + if (Optional.IsDefined(TestScriptFileInfo)) + { + writer.WritePropertyName("testScriptFileInfo"u8); + writer.WriteObjectValue(TestScriptFileInfo, options); + } + if (Optional.IsDefined(UserPropertyFileInfo)) + { + writer.WritePropertyName("userPropFileInfo"u8); + writer.WriteObjectValue(UserPropertyFileInfo, options); + } + if (Optional.IsDefined(InputArtifactsZipFileInfo)) + { + writer.WritePropertyName("inputArtifactsZipFileInfo"u8); + writer.WriteObjectValue(InputArtifactsZipFileInfo, options); + } + if (Optional.IsDefined(UrlTestConfigFileInfo)) + { + writer.WritePropertyName("urlTestConfigFileInfo"u8); + writer.WriteObjectValue(UrlTestConfigFileInfo, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(AdditionalFileInfo)) + { + writer.WritePropertyName("additionalFileInfo"u8); + writer.WriteStartArray(); + foreach (var item in AdditionalFileInfo) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestInputArtifacts IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestInputArtifacts)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestInputArtifacts(document.RootElement, options); + } + + internal static TestInputArtifacts DeserializeTestInputArtifacts(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TestFileInfo configFileInfo = default; + TestFileInfo testScriptFileInfo = default; + TestFileInfo userPropFileInfo = default; + TestFileInfo inputArtifactsZipFileInfo = default; + TestFileInfo urlTestConfigFileInfo = default; + IReadOnlyList additionalFileInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configFileInfo = TestFileInfo.DeserializeTestFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("testScriptFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + testScriptFileInfo = TestFileInfo.DeserializeTestFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("userPropFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userPropFileInfo = TestFileInfo.DeserializeTestFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("inputArtifactsZipFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + inputArtifactsZipFileInfo = TestFileInfo.DeserializeTestFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("urlTestConfigFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + urlTestConfigFileInfo = TestFileInfo.DeserializeTestFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("additionalFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TestFileInfo.DeserializeTestFileInfo(item, options)); + } + additionalFileInfo = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestInputArtifacts( + configFileInfo, + testScriptFileInfo, + userPropFileInfo, + inputArtifactsZipFileInfo, + urlTestConfigFileInfo, + additionalFileInfo ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestInputArtifacts)} does not support writing '{options.Format}' format."); + } + } + + TestInputArtifacts IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestInputArtifacts(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestInputArtifacts)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestInputArtifacts FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestInputArtifacts(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestInputArtifacts.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestInputArtifacts.cs new file mode 100644 index 000000000000..f59c5a94183f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestInputArtifacts.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// The input artifacts for the test. + public partial class TestInputArtifacts + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TestInputArtifacts() + { + AdditionalFileInfo = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The load test YAML file that contains the the test configuration. + /// The test script file for the test run. + /// The user properties file. + /// The zip file with all input artifacts. + /// The config json file for url based test. + /// Additional supported files for the test run. + /// Keeps track of any properties unknown to the library. + internal TestInputArtifacts(TestFileInfo configFileInfo, TestFileInfo testScriptFileInfo, TestFileInfo userPropertyFileInfo, TestFileInfo inputArtifactsZipFileInfo, TestFileInfo urlTestConfigFileInfo, IReadOnlyList additionalFileInfo, IDictionary serializedAdditionalRawData) + { + ConfigFileInfo = configFileInfo; + TestScriptFileInfo = testScriptFileInfo; + UserPropertyFileInfo = userPropertyFileInfo; + InputArtifactsZipFileInfo = inputArtifactsZipFileInfo; + UrlTestConfigFileInfo = urlTestConfigFileInfo; + AdditionalFileInfo = additionalFileInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The load test YAML file that contains the the test configuration. + public TestFileInfo ConfigFileInfo { get; } + /// The test script file for the test run. + public TestFileInfo TestScriptFileInfo { get; } + /// The user properties file. + public TestFileInfo UserPropertyFileInfo { get; } + /// The zip file with all input artifacts. + public TestFileInfo InputArtifactsZipFileInfo { get; } + /// The config json file for url based test. + public TestFileInfo UrlTestConfigFileInfo { get; } + /// Additional supported files for the test run. + public IReadOnlyList AdditionalFileInfo { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfile.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfile.Serialization.cs new file mode 100644 index 000000000000..df38fd2db79f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfile.Serialization.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestProfile)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("testProfileId"u8); + writer.WriteStringValue(TestProfileId); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(TestId)) + { + writer.WritePropertyName("testId"u8); + writer.WriteStringValue(TestId); + } + if (Optional.IsDefined(TargetResourceId)) + { + writer.WritePropertyName("targetResourceId"u8); + writer.WriteStringValue(TargetResourceId); + } + if (Optional.IsDefined(TargetResourceConfigurations)) + { + writer.WritePropertyName("targetResourceConfigurations"u8); + writer.WriteObjectValue(TargetResourceConfigurations, options); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestProfile(document.RootElement, options); + } + + internal static TestProfile DeserializeTestProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string testProfileId = default; + string displayName = default; + string description = default; + string testId = default; + ResourceIdentifier targetResourceId = default; + TargetResourceConfigurations targetResourceConfigurations = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("testProfileId"u8)) + { + testProfileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("testId"u8)) + { + testId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetResourceConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetResourceConfigurations = TargetResourceConfigurations.DeserializeTargetResourceConfigurations(property.Value, options); + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestProfile( + testProfileId, + displayName, + description, + testId, + targetResourceId, + targetResourceConfigurations, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestProfile)} does not support writing '{options.Format}' format."); + } + } + + TestProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestProfile FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestProfile(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfile.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfile.cs new file mode 100644 index 000000000000..1148abffddfd --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfile.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// The Test Profile Model. A Test Profile resource enables you to set up a test profile which contains various configurations for a supported resource type and a load test to execute on that resource. + public partial class TestProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TestProfile() + { + } + + /// Initializes a new instance of . + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Display name of the test profile. + /// Description for the test profile. + /// Associated test ID for the test profile. This property is required for creating a Test Profile and it's not allowed to be updated. + /// Target resource ID on which the test profile is created. This property is required for creating a Test Profile and it's not allowed to be updated. + /// + /// Configurations of the target resource on which testing would be done. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal TestProfile(string testProfileId, string displayName, string description, string testId, ResourceIdentifier targetResourceId, TargetResourceConfigurations targetResourceConfigurations, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + TestProfileId = testProfileId; + DisplayName = displayName; + Description = description; + TestId = testId; + TargetResourceId = targetResourceId; + TargetResourceConfigurations = targetResourceConfigurations; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + public string TestProfileId { get; } + /// Display name of the test profile. + public string DisplayName { get; set; } + /// Description for the test profile. + public string Description { get; set; } + /// Associated test ID for the test profile. This property is required for creating a Test Profile and it's not allowed to be updated. + public string TestId { get; set; } + /// Target resource ID on which the test profile is created. This property is required for creating a Test Profile and it's not allowed to be updated. + public ResourceIdentifier TargetResourceId { get; set; } + /// + /// Configurations of the target resource on which testing would be done. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public TargetResourceConfigurations TargetResourceConfigurations { get; set; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRun.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRun.Serialization.cs new file mode 100644 index 000000000000..68b2853e792b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRun.Serialization.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestProfileRun : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestProfileRun)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("testProfileRunId"u8); + writer.WriteStringValue(TestProfileRunId); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(TestProfileId)) + { + writer.WritePropertyName("testProfileId"u8); + writer.WriteStringValue(TestProfileId); + } + if (options.Format != "W" && Optional.IsDefined(TargetResourceId)) + { + writer.WritePropertyName("targetResourceId"u8); + writer.WriteStringValue(TargetResourceId); + } + if (options.Format != "W" && Optional.IsDefined(TargetResourceConfigurations)) + { + writer.WritePropertyName("targetResourceConfigurations"u8); + writer.WriteObjectValue(TargetResourceConfigurations, options); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ErrorDetails)) + { + writer.WritePropertyName("errorDetails"u8); + writer.WriteStartArray(); + foreach (var item in ErrorDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(StartDateTime)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(EndDateTime)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(DurationInSeconds)) + { + writer.WritePropertyName("durationInSeconds"u8); + writer.WriteNumberValue(DurationInSeconds.Value); + } + if (options.Format != "W" && Optional.IsCollectionDefined(TestRunDetails)) + { + writer.WritePropertyName("testRunDetails"u8); + writer.WriteStartObject(); + foreach (var item in TestRunDetails) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Recommendations)) + { + writer.WritePropertyName("recommendations"u8); + writer.WriteStartArray(); + foreach (var item in Recommendations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestProfileRun IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestProfileRun)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestProfileRun(document.RootElement, options); + } + + internal static TestProfileRun DeserializeTestProfileRun(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string testProfileRunId = default; + string displayName = default; + string description = default; + string testProfileId = default; + ResourceIdentifier targetResourceId = default; + TargetResourceConfigurations targetResourceConfigurations = default; + TestProfileRunStatus? status = default; + IReadOnlyList errorDetails = default; + DateTimeOffset? startDateTime = default; + DateTimeOffset? endDateTime = default; + long? durationInSeconds = default; + IReadOnlyDictionary testRunDetails = default; + IReadOnlyList recommendations = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("testProfileRunId"u8)) + { + testProfileRunId = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("testProfileId"u8)) + { + testProfileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetResourceConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetResourceConfigurations = TargetResourceConfigurations.DeserializeTargetResourceConfigurations(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new TestProfileRunStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("errorDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LoadTesting.ErrorDetails.DeserializeErrorDetails(item, options)); + } + errorDetails = array; + continue; + } + if (property.NameEquals("startDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("durationInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + durationInSeconds = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("testRunDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, TestRunDetail.DeserializeTestRunDetail(property0.Value, options)); + } + testRunDetails = dictionary; + continue; + } + if (property.NameEquals("recommendations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TestProfileRunRecommendation.DeserializeTestProfileRunRecommendation(item, options)); + } + recommendations = array; + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestProfileRun( + testProfileRunId, + displayName, + description, + testProfileId, + targetResourceId, + targetResourceConfigurations, + status, + errorDetails ?? new ChangeTrackingList(), + startDateTime, + endDateTime, + durationInSeconds, + testRunDetails ?? new ChangeTrackingDictionary(), + recommendations ?? new ChangeTrackingList(), + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestProfileRun)} does not support writing '{options.Format}' format."); + } + } + + TestProfileRun IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestProfileRun(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestProfileRun)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestProfileRun FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestProfileRun(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRun.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRun.cs new file mode 100644 index 000000000000..c48bc4d85bdf --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRun.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + /// The Test Profile Run Model. Test Profile Run resource enables you to instantiate an already created test profile and run load tests to get recommendations on the optimal configuration for the target resource. + public partial class TestProfileRun + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TestProfileRun() + { + ErrorDetails = new ChangeTrackingList(); + TestRunDetails = new ChangeTrackingDictionary(); + Recommendations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + /// Display name for the test profile run. + /// The test profile run description. + /// Associated test profile ID for the test profile run. This is required to create a test profile run and can't be updated. + /// Target resource ID on which the test profile run is created. + /// + /// Configurations of the target resource on which the test profile ran. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// The test profile run status. + /// Error details if there is any failure in test profile run. These errors are specific to the Test Profile Run. + /// The test profile run start DateTime(RFC 3339 literal format). + /// The test profile run end DateTime(RFC 3339 literal format). + /// Test profile run duration in seconds. + /// + /// Details of the test runs ran as part of the test profile run. + /// Key is the testRunId of the corresponding testRun. + /// + /// Recommendations provided based on a successful test profile run. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal TestProfileRun(string testProfileRunId, string displayName, string description, string testProfileId, ResourceIdentifier targetResourceId, TargetResourceConfigurations targetResourceConfigurations, TestProfileRunStatus? status, IReadOnlyList errorDetails, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, long? durationInSeconds, IReadOnlyDictionary testRunDetails, IReadOnlyList recommendations, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + TestProfileRunId = testProfileRunId; + DisplayName = displayName; + Description = description; + TestProfileId = testProfileId; + TargetResourceId = targetResourceId; + TargetResourceConfigurations = targetResourceConfigurations; + Status = status; + ErrorDetails = errorDetails; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + DurationInSeconds = durationInSeconds; + TestRunDetails = testRunDetails; + Recommendations = recommendations; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. + public string TestProfileRunId { get; } + /// Display name for the test profile run. + public string DisplayName { get; set; } + /// The test profile run description. + public string Description { get; set; } + /// Associated test profile ID for the test profile run. This is required to create a test profile run and can't be updated. + public string TestProfileId { get; set; } + /// Target resource ID on which the test profile run is created. + public ResourceIdentifier TargetResourceId { get; } + /// + /// Configurations of the target resource on which the test profile ran. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public TargetResourceConfigurations TargetResourceConfigurations { get; } + /// The test profile run status. + public TestProfileRunStatus? Status { get; } + /// Error details if there is any failure in test profile run. These errors are specific to the Test Profile Run. + public IReadOnlyList ErrorDetails { get; } + /// The test profile run start DateTime(RFC 3339 literal format). + public DateTimeOffset? StartDateTime { get; } + /// The test profile run end DateTime(RFC 3339 literal format). + public DateTimeOffset? EndDateTime { get; } + /// Test profile run duration in seconds. + public long? DurationInSeconds { get; } + /// + /// Details of the test runs ran as part of the test profile run. + /// Key is the testRunId of the corresponding testRun. + /// + public IReadOnlyDictionary TestRunDetails { get; } + /// Recommendations provided based on a successful test profile run. + public IReadOnlyList Recommendations { get; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunRecommendation.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunRecommendation.Serialization.cs new file mode 100644 index 000000000000..209d9851f173 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunRecommendation.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestProfileRunRecommendation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestProfileRunRecommendation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.ToString()); + if (Optional.IsCollectionDefined(Configurations)) + { + writer.WritePropertyName("configurations"u8); + writer.WriteStartArray(); + foreach (var item in Configurations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestProfileRunRecommendation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestProfileRunRecommendation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestProfileRunRecommendation(document.RootElement, options); + } + + internal static TestProfileRunRecommendation DeserializeTestProfileRunRecommendation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RecommendationCategory category = default; + IReadOnlyList configurations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("category"u8)) + { + category = new RecommendationCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + configurations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestProfileRunRecommendation(category, configurations ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestProfileRunRecommendation)} does not support writing '{options.Format}' format."); + } + } + + TestProfileRunRecommendation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestProfileRunRecommendation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestProfileRunRecommendation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestProfileRunRecommendation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestProfileRunRecommendation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunRecommendation.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunRecommendation.cs new file mode 100644 index 000000000000..0ffa550c782b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunRecommendation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// A recommendation object that provides a list of configuration that optimizes its category. + public partial class TestProfileRunRecommendation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Category of the recommendation. + internal TestProfileRunRecommendation(RecommendationCategory category) + { + Category = category; + Configurations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Category of the recommendation. + /// List of configurations IDs for which the recommendation is applicable. These are a subset of the provided target resource configurations. + /// Keeps track of any properties unknown to the library. + internal TestProfileRunRecommendation(RecommendationCategory category, IReadOnlyList configurations, IDictionary serializedAdditionalRawData) + { + Category = category; + Configurations = configurations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TestProfileRunRecommendation() + { + } + + /// Category of the recommendation. + public RecommendationCategory Category { get; } + /// List of configurations IDs for which the recommendation is applicable. These are a subset of the provided target resource configurations. + public IReadOnlyList Configurations { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunStatus.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunStatus.cs new file mode 100644 index 000000000000..e7bd29c606fc --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestProfileRunStatus.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Test profile run status. + public readonly partial struct TestProfileRunStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TestProfileRunStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AcceptedValue = "ACCEPTED"; + private const string NotStartedValue = "NOTSTARTED"; + private const string ExecutingValue = "EXECUTING"; + private const string DoneValue = "DONE"; + private const string CancellingValue = "CANCELLING"; + private const string CancelledValue = "CANCELLED"; + private const string FailedValue = "FAILED"; + + /// Test profile run request is accepted. + public static TestProfileRunStatus Accepted { get; } = new TestProfileRunStatus(AcceptedValue); + /// Test profile run is not yet started. + public static TestProfileRunStatus NotStarted { get; } = new TestProfileRunStatus(NotStartedValue); + /// Test profile run has started executing. + public static TestProfileRunStatus Executing { get; } = new TestProfileRunStatus(ExecutingValue); + /// Test profile run has completed successfully. + public static TestProfileRunStatus Done { get; } = new TestProfileRunStatus(DoneValue); + /// Test profile run is being cancelled. + public static TestProfileRunStatus Cancelling { get; } = new TestProfileRunStatus(CancellingValue); + /// Test profile run is cancelled. + public static TestProfileRunStatus Cancelled { get; } = new TestProfileRunStatus(CancelledValue); + /// Test profile run has failed. + public static TestProfileRunStatus Failed { get; } = new TestProfileRunStatus(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(TestProfileRunStatus left, TestProfileRunStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TestProfileRunStatus left, TestProfileRunStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TestProfileRunStatus(string value) => new TestProfileRunStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TestProfileRunStatus other && Equals(other); + /// + public bool Equals(TestProfileRunStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunAppComponents.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunAppComponents.Serialization.cs new file mode 100644 index 000000000000..448f8bcf972c --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunAppComponents.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunAppComponents : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunAppComponents)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("components"u8); + writer.WriteStartObject(); + foreach (var item in Components) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + if (options.Format != "W" && Optional.IsDefined(TestRunId)) + { + writer.WritePropertyName("testRunId"u8); + writer.WriteStringValue(TestRunId); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunAppComponents IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunAppComponents)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunAppComponents(document.RootElement, options); + } + + internal static TestRunAppComponents DeserializeTestRunAppComponents(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary components = default; + string testRunId = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("components"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, LoadTestingAppComponent.DeserializeLoadTestingAppComponent(property0.Value, options)); + } + components = dictionary; + continue; + } + if (property.NameEquals("testRunId"u8)) + { + testRunId = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunAppComponents( + components, + testRunId, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunAppComponents)} does not support writing '{options.Format}' format."); + } + } + + TestRunAppComponents IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunAppComponents(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunAppComponents)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunAppComponents FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunAppComponents(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunAppComponents.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunAppComponents.cs new file mode 100644 index 000000000000..7df877f94aab --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunAppComponents.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Test run app component. + public partial class TestRunAppComponents + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + /// is null. + public TestRunAppComponents(IDictionary components) + { + Argument.AssertNotNull(components, nameof(components)); + + Components = components; + } + + /// Initializes a new instance of . + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + /// Test run identifier. + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal TestRunAppComponents(IDictionary components, string testRunId, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + Components = components; + TestRunId = testRunId; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TestRunAppComponents() + { + } + + /// + /// Azure resource collection { resource id (fully qualified resource Id e.g + /// subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + /// : resource object } + /// + public IDictionary Components { get; } + /// Test run identifier. + public string TestRunId { get; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunArtifacts.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunArtifacts.Serialization.cs new file mode 100644 index 000000000000..1c5eac95657f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunArtifacts.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunArtifacts : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunArtifacts)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(InputArtifacts)) + { + writer.WritePropertyName("inputArtifacts"u8); + writer.WriteObjectValue(InputArtifacts, options); + } + if (Optional.IsDefined(OutputArtifacts)) + { + writer.WritePropertyName("outputArtifacts"u8); + writer.WriteObjectValue(OutputArtifacts, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunArtifacts IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunArtifacts)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunArtifacts(document.RootElement, options); + } + + internal static TestRunArtifacts DeserializeTestRunArtifacts(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TestRunInputArtifacts inputArtifacts = default; + TestRunOutputArtifacts outputArtifacts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("inputArtifacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + inputArtifacts = TestRunInputArtifacts.DeserializeTestRunInputArtifacts(property.Value, options); + continue; + } + if (property.NameEquals("outputArtifacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outputArtifacts = TestRunOutputArtifacts.DeserializeTestRunOutputArtifacts(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunArtifacts(inputArtifacts, outputArtifacts, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunArtifacts)} does not support writing '{options.Format}' format."); + } + } + + TestRunArtifacts IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunArtifacts(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunArtifacts)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunArtifacts FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunArtifacts(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunArtifacts.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunArtifacts.cs new file mode 100644 index 000000000000..ebf85cfa6567 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunArtifacts.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Collection of test run artifacts. + public partial class TestRunArtifacts + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TestRunArtifacts() + { + } + + /// Initializes a new instance of . + /// The input artifacts for the test run. + /// The output artifacts for the test run. + /// Keeps track of any properties unknown to the library. + internal TestRunArtifacts(TestRunInputArtifacts inputArtifacts, TestRunOutputArtifacts outputArtifacts, IDictionary serializedAdditionalRawData) + { + InputArtifacts = inputArtifacts; + OutputArtifacts = outputArtifacts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The input artifacts for the test run. + public TestRunInputArtifacts InputArtifacts { get; } + /// The output artifacts for the test run. + public TestRunOutputArtifacts OutputArtifacts { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunDetail.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunDetail.Serialization.cs new file mode 100644 index 000000000000..b24aea0b6435 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunDetail.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunDetail : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunDetail)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + writer.WritePropertyName("configurationId"u8); + writer.WriteStringValue(ConfigurationId); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + foreach (var item in Properties) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunDetail IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunDetail)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunDetail(document.RootElement, options); + } + + internal static TestRunDetail DeserializeTestRunDetail(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TestRunStatus status = default; + string configurationId = default; + IReadOnlyDictionary properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + status = new TestRunStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationId"u8)) + { + configurationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + properties = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunDetail(status, configurationId, properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunDetail)} does not support writing '{options.Format}' format."); + } + } + + TestRunDetail IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunDetail(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunDetail)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunDetail FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunDetail(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunDetail.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunDetail.cs new file mode 100644 index 000000000000..2be47512ac2b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunDetail.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Details of a particular test run for a test profile run. + public partial class TestRunDetail + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Status of the test run. + /// ID of the configuration on which the test ran. + /// Key value pair of extra properties associated with the test run. + /// or is null. + internal TestRunDetail(TestRunStatus status, string configurationId, IReadOnlyDictionary properties) + { + Argument.AssertNotNull(configurationId, nameof(configurationId)); + Argument.AssertNotNull(properties, nameof(properties)); + + Status = status; + ConfigurationId = configurationId; + Properties = properties; + } + + /// Initializes a new instance of . + /// Status of the test run. + /// ID of the configuration on which the test ran. + /// Key value pair of extra properties associated with the test run. + /// Keeps track of any properties unknown to the library. + internal TestRunDetail(TestRunStatus status, string configurationId, IReadOnlyDictionary properties, IDictionary serializedAdditionalRawData) + { + Status = status; + ConfigurationId = configurationId; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TestRunDetail() + { + } + + /// Status of the test run. + public TestRunStatus Status { get; } + /// ID of the configuration on which the test ran. + public string ConfigurationId { get; } + /// Key value pair of extra properties associated with the test run. + public IReadOnlyDictionary Properties { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunFileInfo.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunFileInfo.Serialization.cs new file mode 100644 index 000000000000..78bef4881be4 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunFileInfo.Serialization.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunFileInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunFileInfo)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("fileName"u8); + writer.WriteStringValue(FileName); + if (options.Format != "W" && Optional.IsDefined(Uri)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (options.Format != "W" && Optional.IsDefined(FileType)) + { + writer.WritePropertyName("fileType"u8); + writer.WriteStringValue(FileType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ExpiresOn)) + { + writer.WritePropertyName("expireDateTime"u8); + writer.WriteStringValue(ExpiresOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ValidationStatus)) + { + writer.WritePropertyName("validationStatus"u8); + writer.WriteStringValue(ValidationStatus.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ValidationFailureDetails)) + { + writer.WritePropertyName("validationFailureDetails"u8); + writer.WriteStringValue(ValidationFailureDetails); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunFileInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunFileInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunFileInfo(document.RootElement, options); + } + + internal static TestRunFileInfo DeserializeTestRunFileInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileName = default; + Uri url = default; + LoadTestingFileType? fileType = default; + DateTimeOffset? expireDateTime = default; + FileValidationStatus? validationStatus = default; + string validationFailureDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("fileName"u8)) + { + fileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("url"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + url = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("fileType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileType = new LoadTestingFileType(property.Value.GetString()); + continue; + } + if (property.NameEquals("expireDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expireDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("validationStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationStatus = new FileValidationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("validationFailureDetails"u8)) + { + validationFailureDetails = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunFileInfo( + fileName, + url, + fileType, + expireDateTime, + validationStatus, + validationFailureDetails, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunFileInfo)} does not support writing '{options.Format}' format."); + } + } + + TestRunFileInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunFileInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunFileInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunFileInfo FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunFileInfo(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunFileInfo.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunFileInfo.cs new file mode 100644 index 000000000000..57896a725b79 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunFileInfo.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Test run file info. + public partial class TestRunFileInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the file. + /// is null. + internal TestRunFileInfo(string fileName) + { + Argument.AssertNotNull(fileName, nameof(fileName)); + + FileName = fileName; + } + + /// Initializes a new instance of . + /// Name of the file. + /// File URL. + /// File type. + /// Expiry time of the file (RFC 3339 literal format). + /// Validation status of the file. + /// Validation failure error details. + /// Keeps track of any properties unknown to the library. + internal TestRunFileInfo(string fileName, Uri uri, LoadTestingFileType? fileType, DateTimeOffset? expiresOn, FileValidationStatus? validationStatus, string validationFailureDetails, IDictionary serializedAdditionalRawData) + { + FileName = fileName; + Uri = uri; + FileType = fileType; + ExpiresOn = expiresOn; + ValidationStatus = validationStatus; + ValidationFailureDetails = validationFailureDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TestRunFileInfo() + { + } + + /// Name of the file. + public string FileName { get; } + /// File URL. + public Uri Uri { get; } + /// File type. + public LoadTestingFileType? FileType { get; } + /// Expiry time of the file (RFC 3339 literal format). + public DateTimeOffset? ExpiresOn { get; } + /// Validation status of the file. + public FileValidationStatus? ValidationStatus { get; } + /// Validation failure error details. + public string ValidationFailureDetails { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunInputArtifacts.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunInputArtifacts.Serialization.cs new file mode 100644 index 000000000000..352fc13cf84f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunInputArtifacts.Serialization.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunInputArtifacts : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunInputArtifacts)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ConfigFileInfo)) + { + writer.WritePropertyName("configFileInfo"u8); + writer.WriteObjectValue(ConfigFileInfo, options); + } + if (Optional.IsDefined(TestScriptFileInfo)) + { + writer.WritePropertyName("testScriptFileInfo"u8); + writer.WriteObjectValue(TestScriptFileInfo, options); + } + if (Optional.IsDefined(UserPropertyFileInfo)) + { + writer.WritePropertyName("userPropFileInfo"u8); + writer.WriteObjectValue(UserPropertyFileInfo, options); + } + if (Optional.IsDefined(InputArtifactsZipFileInfo)) + { + writer.WritePropertyName("inputArtifactsZipFileInfo"u8); + writer.WriteObjectValue(InputArtifactsZipFileInfo, options); + } + if (Optional.IsDefined(UrlTestConfigFileInfo)) + { + writer.WritePropertyName("urlTestConfigFileInfo"u8); + writer.WriteObjectValue(UrlTestConfigFileInfo, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(AdditionalFileInfo)) + { + writer.WritePropertyName("additionalFileInfo"u8); + writer.WriteStartArray(); + foreach (var item in AdditionalFileInfo) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunInputArtifacts IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunInputArtifacts)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunInputArtifacts(document.RootElement, options); + } + + internal static TestRunInputArtifacts DeserializeTestRunInputArtifacts(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TestRunFileInfo configFileInfo = default; + TestRunFileInfo testScriptFileInfo = default; + TestRunFileInfo userPropFileInfo = default; + TestRunFileInfo inputArtifactsZipFileInfo = default; + TestRunFileInfo urlTestConfigFileInfo = default; + IReadOnlyList additionalFileInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("testScriptFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + testScriptFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("userPropFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userPropFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("inputArtifactsZipFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + inputArtifactsZipFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("urlTestConfigFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + urlTestConfigFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("additionalFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TestRunFileInfo.DeserializeTestRunFileInfo(item, options)); + } + additionalFileInfo = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunInputArtifacts( + configFileInfo, + testScriptFileInfo, + userPropFileInfo, + inputArtifactsZipFileInfo, + urlTestConfigFileInfo, + additionalFileInfo ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunInputArtifacts)} does not support writing '{options.Format}' format."); + } + } + + TestRunInputArtifacts IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunInputArtifacts(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunInputArtifacts)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunInputArtifacts FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunInputArtifacts(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunInputArtifacts.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunInputArtifacts.cs new file mode 100644 index 000000000000..bc2161dfff03 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunInputArtifacts.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// The input artifacts for the test run. + public partial class TestRunInputArtifacts + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TestRunInputArtifacts() + { + AdditionalFileInfo = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The load test YAML file that contains the the test configuration. + /// The test script file for the test run. + /// The user properties file. + /// The zip file for all input artifacts. + /// The config json file for url based test. + /// Additional supported files for the test run. + /// Keeps track of any properties unknown to the library. + internal TestRunInputArtifacts(TestRunFileInfo configFileInfo, TestRunFileInfo testScriptFileInfo, TestRunFileInfo userPropertyFileInfo, TestRunFileInfo inputArtifactsZipFileInfo, TestRunFileInfo urlTestConfigFileInfo, IReadOnlyList additionalFileInfo, IDictionary serializedAdditionalRawData) + { + ConfigFileInfo = configFileInfo; + TestScriptFileInfo = testScriptFileInfo; + UserPropertyFileInfo = userPropertyFileInfo; + InputArtifactsZipFileInfo = inputArtifactsZipFileInfo; + UrlTestConfigFileInfo = urlTestConfigFileInfo; + AdditionalFileInfo = additionalFileInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The load test YAML file that contains the the test configuration. + public TestRunFileInfo ConfigFileInfo { get; } + /// The test script file for the test run. + public TestRunFileInfo TestScriptFileInfo { get; } + /// The user properties file. + public TestRunFileInfo UserPropertyFileInfo { get; } + /// The zip file for all input artifacts. + public TestRunFileInfo InputArtifactsZipFileInfo { get; } + /// The config json file for url based test. + public TestRunFileInfo UrlTestConfigFileInfo { get; } + /// Additional supported files for the test run. + public IReadOnlyList AdditionalFileInfo { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunOutputArtifacts.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunOutputArtifacts.Serialization.cs new file mode 100644 index 000000000000..aabcb0665129 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunOutputArtifacts.Serialization.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunOutputArtifacts : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunOutputArtifacts)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ResultFileInfo)) + { + writer.WritePropertyName("resultFileInfo"u8); + writer.WriteObjectValue(ResultFileInfo, options); + } + if (Optional.IsDefined(LogsFileInfo)) + { + writer.WritePropertyName("logsFileInfo"u8); + writer.WriteObjectValue(LogsFileInfo, options); + } + if (Optional.IsDefined(ArtifactsContainerInfo)) + { + writer.WritePropertyName("artifactsContainerInfo"u8); + writer.WriteObjectValue(ArtifactsContainerInfo, options); + } + if (Optional.IsDefined(ReportFileInfo)) + { + writer.WritePropertyName("reportFileInfo"u8); + writer.WriteObjectValue(ReportFileInfo, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunOutputArtifacts IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunOutputArtifacts)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunOutputArtifacts(document.RootElement, options); + } + + internal static TestRunOutputArtifacts DeserializeTestRunOutputArtifacts(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TestRunFileInfo resultFileInfo = default; + TestRunFileInfo logsFileInfo = default; + ArtifactsContainerInfo artifactsContainerInfo = default; + TestRunFileInfo reportFileInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resultFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("logsFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logsFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (property.NameEquals("artifactsContainerInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactsContainerInfo = ArtifactsContainerInfo.DeserializeArtifactsContainerInfo(property.Value, options); + continue; + } + if (property.NameEquals("reportFileInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reportFileInfo = TestRunFileInfo.DeserializeTestRunFileInfo(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunOutputArtifacts(resultFileInfo, logsFileInfo, artifactsContainerInfo, reportFileInfo, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunOutputArtifacts)} does not support writing '{options.Format}' format."); + } + } + + TestRunOutputArtifacts IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunOutputArtifacts(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunOutputArtifacts)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunOutputArtifacts FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunOutputArtifacts(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunOutputArtifacts.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunOutputArtifacts.cs new file mode 100644 index 000000000000..2d16a4940219 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunOutputArtifacts.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// The output artifacts for the test run. + public partial class TestRunOutputArtifacts + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TestRunOutputArtifacts() + { + } + + /// Initializes a new instance of . + /// The test run results file. + /// The test run report with metrics. + /// The container for test run artifacts. + /// The report file for the test run. + /// Keeps track of any properties unknown to the library. + internal TestRunOutputArtifacts(TestRunFileInfo resultFileInfo, TestRunFileInfo logsFileInfo, ArtifactsContainerInfo artifactsContainerInfo, TestRunFileInfo reportFileInfo, IDictionary serializedAdditionalRawData) + { + ResultFileInfo = resultFileInfo; + LogsFileInfo = logsFileInfo; + ArtifactsContainerInfo = artifactsContainerInfo; + ReportFileInfo = reportFileInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The test run results file. + public TestRunFileInfo ResultFileInfo { get; } + /// The test run report with metrics. + public TestRunFileInfo LogsFileInfo { get; } + /// The container for test run artifacts. + public ArtifactsContainerInfo ArtifactsContainerInfo { get; } + /// The report file for the test run. + public TestRunFileInfo ReportFileInfo { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunServerMetricsConfiguration.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunServerMetricsConfiguration.Serialization.cs new file mode 100644 index 000000000000..b25816407cba --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunServerMetricsConfiguration.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunServerMetricsConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunServerMetricsConfiguration)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(TestRunId)) + { + writer.WritePropertyName("testRunId"u8); + writer.WriteStringValue(TestRunId); + } + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("metrics"u8); + writer.WriteStartObject(); + foreach (var item in Metrics) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunServerMetricsConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunServerMetricsConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunServerMetricsConfiguration(document.RootElement, options); + } + + internal static TestRunServerMetricsConfiguration DeserializeTestRunServerMetricsConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string testRunId = default; + IDictionary metrics = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("testRunId"u8)) + { + testRunId = property.Value.GetString(); + continue; + } + if (property.NameEquals("metrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ResourceMetric.DeserializeResourceMetric(property0.Value, options)); + } + metrics = dictionary; + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunServerMetricsConfiguration( + testRunId, + metrics ?? new ChangeTrackingDictionary(), + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunServerMetricsConfiguration)} does not support writing '{options.Format}' format."); + } + } + + TestRunServerMetricsConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunServerMetricsConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunServerMetricsConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunServerMetricsConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunServerMetricsConfiguration(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunServerMetricsConfiguration.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunServerMetricsConfiguration.cs new file mode 100644 index 000000000000..b9a6d3ef0c4a --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunServerMetricsConfiguration.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Test run server metrics configuration. + public partial class TestRunServerMetricsConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TestRunServerMetricsConfiguration() + { + Metrics = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Test run identifier. + /// + /// Azure resource metrics collection {metric id : metrics object} (Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + /// for metric id). + /// + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal TestRunServerMetricsConfiguration(string testRunId, IDictionary metrics, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + TestRunId = testRunId; + Metrics = metrics; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Test run identifier. + public string TestRunId { get; } + /// + /// Azure resource metrics collection {metric id : metrics object} (Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + /// for metric id). + /// + public IDictionary Metrics { get; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatistics.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatistics.Serialization.cs new file mode 100644 index 000000000000..17e04f586300 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatistics.Serialization.cs @@ -0,0 +1,451 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestRunStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunStatistics)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Transaction)) + { + writer.WritePropertyName("transaction"u8); + writer.WriteStringValue(Transaction); + } + if (options.Format != "W" && Optional.IsDefined(SampleCount)) + { + writer.WritePropertyName("sampleCount"u8); + writer.WriteNumberValue(SampleCount.Value); + } + if (options.Format != "W" && Optional.IsDefined(ErrorCount)) + { + writer.WritePropertyName("errorCount"u8); + writer.WriteNumberValue(ErrorCount.Value); + } + if (options.Format != "W" && Optional.IsDefined(ErrorPercentage)) + { + writer.WritePropertyName("errorPct"u8); + writer.WriteNumberValue(ErrorPercentage.Value); + } + if (options.Format != "W" && Optional.IsDefined(MeanResponseTime)) + { + writer.WritePropertyName("meanResTime"u8); + writer.WriteNumberValue(MeanResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(MedianResponseTime)) + { + writer.WritePropertyName("medianResTime"u8); + writer.WriteNumberValue(MedianResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(MaxResponseTime)) + { + writer.WritePropertyName("maxResTime"u8); + writer.WriteNumberValue(MaxResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(MinResponseTime)) + { + writer.WritePropertyName("minResTime"u8); + writer.WriteNumberValue(MinResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile90ResponseTime)) + { + writer.WritePropertyName("pct1ResTime"u8); + writer.WriteNumberValue(Percentile90ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile95ResponseTime)) + { + writer.WritePropertyName("pct2ResTime"u8); + writer.WriteNumberValue(Percentile95ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile99ResponseTime)) + { + writer.WritePropertyName("pct3ResTime"u8); + writer.WriteNumberValue(Percentile99ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile75ResponseTime)) + { + writer.WritePropertyName("pct75ResTime"u8); + writer.WriteNumberValue(Percentile75ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile96ResponseTime)) + { + writer.WritePropertyName("pct96ResTime"u8); + writer.WriteNumberValue(Percentile96ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile97ResponseTime)) + { + writer.WritePropertyName("pct97ResTime"u8); + writer.WriteNumberValue(Percentile97ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile98ResponseTime)) + { + writer.WritePropertyName("pct98ResTime"u8); + writer.WriteNumberValue(Percentile98ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile999ResponseTime)) + { + writer.WritePropertyName("pct999ResTime"u8); + writer.WriteNumberValue(Percentile999ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Percentile9999ResponseTime)) + { + writer.WritePropertyName("pct9999ResTime"u8); + writer.WriteNumberValue(Percentile9999ResponseTime.Value); + } + if (options.Format != "W" && Optional.IsDefined(Throughput)) + { + writer.WritePropertyName("throughput"u8); + writer.WriteNumberValue(Throughput.Value); + } + if (options.Format != "W" && Optional.IsDefined(ReceivedKBytesPerSec)) + { + writer.WritePropertyName("receivedKBytesPerSec"u8); + writer.WriteNumberValue(ReceivedKBytesPerSec.Value); + } + if (options.Format != "W" && Optional.IsDefined(SentKBytesPerSec)) + { + writer.WritePropertyName("sentKBytesPerSec"u8); + writer.WriteNumberValue(SentKBytesPerSec.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestRunStatistics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestRunStatistics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestRunStatistics(document.RootElement, options); + } + + internal static TestRunStatistics DeserializeTestRunStatistics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string transaction = default; + double? sampleCount = default; + double? errorCount = default; + double? errorPct = default; + double? meanResTime = default; + double? medianResTime = default; + double? maxResTime = default; + double? minResTime = default; + double? pct1ResTime = default; + double? pct2ResTime = default; + double? pct3ResTime = default; + double? pct75ResTime = default; + double? pct96ResTime = default; + double? pct97ResTime = default; + double? pct98ResTime = default; + double? pct999ResTime = default; + double? pct9999ResTime = default; + double? throughput = default; + double? receivedKBytesPerSec = default; + double? sentKBytesPerSec = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("transaction"u8)) + { + transaction = property.Value.GetString(); + continue; + } + if (property.NameEquals("sampleCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sampleCount = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("errorCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorCount = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("errorPct"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorPct = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("meanResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + meanResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("medianResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + medianResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("maxResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("minResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct1ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct1ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct2ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct2ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct3ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct3ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct75ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct75ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct96ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct96ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct97ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct97ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct98ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct98ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct999ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct999ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("pct9999ResTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pct9999ResTime = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("throughput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + throughput = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("receivedKBytesPerSec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + receivedKBytesPerSec = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("sentKBytesPerSec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sentKBytesPerSec = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestRunStatistics( + transaction, + sampleCount, + errorCount, + errorPct, + meanResTime, + medianResTime, + maxResTime, + minResTime, + pct1ResTime, + pct2ResTime, + pct3ResTime, + pct75ResTime, + pct96ResTime, + pct97ResTime, + pct98ResTime, + pct999ResTime, + pct9999ResTime, + throughput, + receivedKBytesPerSec, + sentKBytesPerSec, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestRunStatistics)} does not support writing '{options.Format}' format."); + } + } + + TestRunStatistics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunStatistics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestRunStatistics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestRunStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestRunStatistics(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatistics.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatistics.cs new file mode 100644 index 000000000000..314487a581c8 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatistics.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Test run statistics. + public partial class TestRunStatistics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TestRunStatistics() + { + } + + /// Initializes a new instance of . + /// Transaction name. + /// Sampler count. + /// Error count. + /// Error percentage. + /// Mean response time. + /// Median response time. + /// Max response time. + /// Minimum response time. + /// 90 percentile response time. + /// 95 percentile response time. + /// 99 percentile response time. + /// 75 percentile response time. + /// 96 percentile response time. + /// 97 percentile response time. + /// 98 percentile response time. + /// 99.9 percentile response time. + /// 99.99 percentile response time. + /// Throughput. + /// Received network bytes. + /// Send network bytes. + /// Keeps track of any properties unknown to the library. + internal TestRunStatistics(string transaction, double? sampleCount, double? errorCount, double? errorPercentage, double? meanResponseTime, double? medianResponseTime, double? maxResponseTime, double? minResponseTime, double? percentile90ResponseTime, double? percentile95ResponseTime, double? percentile99ResponseTime, double? percentile75ResponseTime, double? percentile96ResponseTime, double? percentile97ResponseTime, double? percentile98ResponseTime, double? percentile999ResponseTime, double? percentile9999ResponseTime, double? throughput, double? receivedKBytesPerSec, double? sentKBytesPerSec, IDictionary serializedAdditionalRawData) + { + Transaction = transaction; + SampleCount = sampleCount; + ErrorCount = errorCount; + ErrorPercentage = errorPercentage; + MeanResponseTime = meanResponseTime; + MedianResponseTime = medianResponseTime; + MaxResponseTime = maxResponseTime; + MinResponseTime = minResponseTime; + Percentile90ResponseTime = percentile90ResponseTime; + Percentile95ResponseTime = percentile95ResponseTime; + Percentile99ResponseTime = percentile99ResponseTime; + Percentile75ResponseTime = percentile75ResponseTime; + Percentile96ResponseTime = percentile96ResponseTime; + Percentile97ResponseTime = percentile97ResponseTime; + Percentile98ResponseTime = percentile98ResponseTime; + Percentile999ResponseTime = percentile999ResponseTime; + Percentile9999ResponseTime = percentile9999ResponseTime; + Throughput = throughput; + ReceivedKBytesPerSec = receivedKBytesPerSec; + SentKBytesPerSec = sentKBytesPerSec; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Transaction name. + public string Transaction { get; } + /// Sampler count. + public double? SampleCount { get; } + /// Error count. + public double? ErrorCount { get; } + /// Error percentage. + public double? ErrorPercentage { get; } + /// Mean response time. + public double? MeanResponseTime { get; } + /// Median response time. + public double? MedianResponseTime { get; } + /// Max response time. + public double? MaxResponseTime { get; } + /// Minimum response time. + public double? MinResponseTime { get; } + /// 90 percentile response time. + public double? Percentile90ResponseTime { get; } + /// 95 percentile response time. + public double? Percentile95ResponseTime { get; } + /// 99 percentile response time. + public double? Percentile99ResponseTime { get; } + /// 75 percentile response time. + public double? Percentile75ResponseTime { get; } + /// 96 percentile response time. + public double? Percentile96ResponseTime { get; } + /// 97 percentile response time. + public double? Percentile97ResponseTime { get; } + /// 98 percentile response time. + public double? Percentile98ResponseTime { get; } + /// 99.9 percentile response time. + public double? Percentile999ResponseTime { get; } + /// 99.99 percentile response time. + public double? Percentile9999ResponseTime { get; } + /// Throughput. + public double? Throughput { get; } + /// Received network bytes. + public double? ReceivedKBytesPerSec { get; } + /// Send network bytes. + public double? SentKBytesPerSec { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatus.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatus.cs new file mode 100644 index 000000000000..53ee327572e5 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestRunStatus.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Test run status. + public readonly partial struct TestRunStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TestRunStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AcceptedValue = "ACCEPTED"; + private const string NotStartedValue = "NOTSTARTED"; + private const string ProvisioningValue = "PROVISIONING"; + private const string ProvisionedValue = "PROVISIONED"; + private const string ConfiguringValue = "CONFIGURING"; + private const string ConfiguredValue = "CONFIGURED"; + private const string ExecutingValue = "EXECUTING"; + private const string ExecutedValue = "EXECUTED"; + private const string DeprovisioningValue = "DEPROVISIONING"; + private const string DeprovisionedValue = "DEPROVISIONED"; + private const string DoneValue = "DONE"; + private const string CancellingValue = "CANCELLING"; + private const string CancelledValue = "CANCELLED"; + private const string FailedValue = "FAILED"; + private const string ValidationSuccessValue = "VALIDATION_SUCCESS"; + private const string ValidationFailureValue = "VALIDATION_FAILURE"; + + /// Test run request is accepted. + public static TestRunStatus Accepted { get; } = new TestRunStatus(AcceptedValue); + /// Test run is not yet started. + public static TestRunStatus NotStarted { get; } = new TestRunStatus(NotStartedValue); + /// Test run is provisioning. + public static TestRunStatus Provisioning { get; } = new TestRunStatus(ProvisioningValue); + /// Test run is provisioned. + public static TestRunStatus Provisioned { get; } = new TestRunStatus(ProvisionedValue); + /// Test run is getting configured. + public static TestRunStatus Configuring { get; } = new TestRunStatus(ConfiguringValue); + /// Test run configuration is done. + public static TestRunStatus Configured { get; } = new TestRunStatus(ConfiguredValue); + /// Test run has started executing. + public static TestRunStatus Executing { get; } = new TestRunStatus(ExecutingValue); + /// Test run execution is completed. + public static TestRunStatus Executed { get; } = new TestRunStatus(ExecutedValue); + /// Test run is getting deprovisioned. + public static TestRunStatus Deprovisioning { get; } = new TestRunStatus(DeprovisioningValue); + /// Test run is deprovisioned. + public static TestRunStatus Deprovisioned { get; } = new TestRunStatus(DeprovisionedValue); + /// Test run is completed. + public static TestRunStatus Done { get; } = new TestRunStatus(DoneValue); + /// Test run is being cancelled. + public static TestRunStatus Cancelling { get; } = new TestRunStatus(CancellingValue); + /// Test run request is cancelled. + public static TestRunStatus Cancelled { get; } = new TestRunStatus(CancelledValue); + /// Test run request is failed. + public static TestRunStatus Failed { get; } = new TestRunStatus(FailedValue); + /// Test run JMX file is validated. + public static TestRunStatus ValidationSuccess { get; } = new TestRunStatus(ValidationSuccessValue); + /// Test run JMX file validation is failed. + public static TestRunStatus ValidationFailure { get; } = new TestRunStatus(ValidationFailureValue); + /// Determines if two values are the same. + public static bool operator ==(TestRunStatus left, TestRunStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TestRunStatus left, TestRunStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TestRunStatus(string value) => new TestRunStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TestRunStatus other && Equals(other); + /// + public bool Equals(TestRunStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestSecret.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestSecret.Serialization.cs new file mode 100644 index 000000000000..b83bf416e9fa --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestSecret.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestSecret : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestSecret)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(SecretKind)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(SecretKind.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestSecret IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestSecret)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestSecret(document.RootElement, options); + } + + internal static TestSecret DeserializeTestSecret(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + SecretType? type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new SecretType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestSecret(value, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestSecret)} does not support writing '{options.Format}' format."); + } + } + + TestSecret IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestSecret(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestSecret)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestSecret FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestSecret(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestSecret.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestSecret.cs new file mode 100644 index 000000000000..8e3fdb7897ae --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestSecret.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Secret. + public partial class TestSecret + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TestSecret() + { + } + + /// Initializes a new instance of . + /// The value of the secret for the respective type. + /// Type of secret. + /// Keeps track of any properties unknown to the library. + internal TestSecret(string value, SecretType? secretKind, IDictionary serializedAdditionalRawData) + { + Value = value; + SecretKind = secretKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The value of the secret for the respective type. + public string Value { get; set; } + /// Type of secret. + public SecretType? SecretKind { get; set; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestServerMetricsConfiguration.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestServerMetricsConfiguration.Serialization.cs new file mode 100644 index 000000000000..696e0350998b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestServerMetricsConfiguration.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TestServerMetricsConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestServerMetricsConfiguration)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(TestId)) + { + writer.WritePropertyName("testId"u8); + writer.WriteStringValue(TestId); + } + writer.WritePropertyName("metrics"u8); + writer.WriteStartObject(); + foreach (var item in Metrics) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + if (options.Format != "W" && Optional.IsDefined(CreatedDateTime)) + { + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CreatedBy)) + { + writer.WritePropertyName("createdBy"u8); + writer.WriteStringValue(CreatedBy); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedDateTime)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedDateTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastModifiedBy)) + { + writer.WritePropertyName("lastModifiedBy"u8); + writer.WriteStringValue(LastModifiedBy); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TestServerMetricsConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TestServerMetricsConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTestServerMetricsConfiguration(document.RootElement, options); + } + + internal static TestServerMetricsConfiguration DeserializeTestServerMetricsConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string testId = default; + IDictionary metrics = default; + DateTimeOffset? createdDateTime = default; + string createdBy = default; + DateTimeOffset? lastModifiedDateTime = default; + string lastModifiedBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("testId"u8)) + { + testId = property.Value.GetString(); + continue; + } + if (property.NameEquals("metrics"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ResourceMetric.DeserializeResourceMetric(property0.Value, options)); + } + metrics = dictionary; + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TestServerMetricsConfiguration( + testId, + metrics, + createdDateTime, + createdBy, + lastModifiedDateTime, + lastModifiedBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TestServerMetricsConfiguration)} does not support writing '{options.Format}' format."); + } + } + + TestServerMetricsConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestServerMetricsConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TestServerMetricsConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TestServerMetricsConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTestServerMetricsConfiguration(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestServerMetricsConfiguration.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestServerMetricsConfiguration.cs new file mode 100644 index 000000000000..c36ad8b4f554 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TestServerMetricsConfiguration.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Test server metrics configuration. + public partial class TestServerMetricsConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// Azure resource metrics collection {metric id : metrics object} (Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + /// for metric id). + /// + /// is null. + public TestServerMetricsConfiguration(IDictionary metrics) + { + Argument.AssertNotNull(metrics, nameof(metrics)); + + Metrics = metrics; + } + + /// Initializes a new instance of . + /// Test identifier. + /// + /// Azure resource metrics collection {metric id : metrics object} (Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + /// for metric id). + /// + /// The creation datetime(RFC 3339 literal format). + /// The user that created. + /// The last Modified datetime(RFC 3339 literal format). + /// The user that last modified. + /// Keeps track of any properties unknown to the library. + internal TestServerMetricsConfiguration(string testId, IDictionary metrics, DateTimeOffset? createdDateTime, string createdBy, DateTimeOffset? lastModifiedDateTime, string lastModifiedBy, IDictionary serializedAdditionalRawData) + { + TestId = testId; + Metrics = metrics; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + LastModifiedDateTime = lastModifiedDateTime; + LastModifiedBy = lastModifiedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TestServerMetricsConfiguration() + { + } + + /// Test identifier. + public string TestId { get; } + /// + /// Azure resource metrics collection {metric id : metrics object} (Refer : + /// https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + /// for metric id). + /// + public IDictionary Metrics { get; } + /// The creation datetime(RFC 3339 literal format). + public DateTimeOffset? CreatedDateTime { get; } + /// The user that created. + public string CreatedBy { get; } + /// The last Modified datetime(RFC 3339 literal format). + public DateTimeOffset? LastModifiedDateTime { get; } + /// The user that last modified. + public string LastModifiedBy { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeGrain.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeGrain.cs new file mode 100644 index 000000000000..87c543443180 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeGrain.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.LoadTesting +{ + /// Time Grain. + public readonly partial struct TimeGrain : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TimeGrain(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FiveSecondsValue = "PT5S"; + private const string TenSecondsValue = "PT10S"; + private const string OneMinuteValue = "PT1M"; + private const string FiveMinutesValue = "PT5M"; + private const string OneHourValue = "PT1H"; + + /// 5 seconds, available only if test run duration is less than 10 minutes. + public static TimeGrain FiveSeconds { get; } = new TimeGrain(FiveSecondsValue); + /// 10 seconds, available only if test run duration is less than 10 minutes. + public static TimeGrain TenSeconds { get; } = new TimeGrain(TenSecondsValue); + /// 1 minute. + public static TimeGrain OneMinute { get; } = new TimeGrain(OneMinuteValue); + /// 5 minutes, available only if test run duration is greater than 1 minute. + public static TimeGrain FiveMinutes { get; } = new TimeGrain(FiveMinutesValue); + /// 1 hour, available only if test run duration is greater than 1 minute. + public static TimeGrain OneHour { get; } = new TimeGrain(OneHourValue); + /// Determines if two values are the same. + public static bool operator ==(TimeGrain left, TimeGrain right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TimeGrain left, TimeGrain right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TimeGrain(string value) => new TimeGrain(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TimeGrain other && Equals(other); + /// + public bool Equals(TimeGrain other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeSeriesElement.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeSeriesElement.Serialization.cs new file mode 100644 index 000000000000..781aac916e7e --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeSeriesElement.Serialization.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + public partial class TimeSeriesElement : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeSeriesElement)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DimensionValues)) + { + writer.WritePropertyName("dimensionValues"u8); + writer.WriteStartArray(); + foreach (var item in DimensionValues) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TimeSeriesElement IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeSeriesElement)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTimeSeriesElement(document.RootElement, options); + } + + internal static TimeSeriesElement DeserializeTimeSeriesElement(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList data = default; + IReadOnlyList dimensionValues = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("data"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricValue.DeserializeMetricValue(item, options)); + } + data = array; + continue; + } + if (property.NameEquals("dimensionValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DimensionValue.DeserializeDimensionValue(item, options)); + } + dimensionValues = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TimeSeriesElement(data ?? new ChangeTrackingList(), dimensionValues ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TimeSeriesElement)} does not support writing '{options.Format}' format."); + } + } + + TimeSeriesElement IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTimeSeriesElement(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TimeSeriesElement)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TimeSeriesElement FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTimeSeriesElement(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeSeriesElement.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeSeriesElement.cs new file mode 100644 index 000000000000..d8da142d5293 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/TimeSeriesElement.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// The time series returned when a data query is performed. + public partial class TimeSeriesElement + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TimeSeriesElement() + { + Data = new ChangeTrackingList(); + DimensionValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// An array of data points representing the metric values. + /// The dimension values. + /// Keeps track of any properties unknown to the library. + internal TimeSeriesElement(IReadOnlyList data, IReadOnlyList dimensionValues, IDictionary serializedAdditionalRawData) + { + Data = data; + DimensionValues = dimensionValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// An array of data points representing the metric values. + public IReadOnlyList Data { get; } + /// The dimension values. + public IReadOnlyList DimensionValues { get; } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/UnknownTargetResourceConfigurations.Serialization.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/UnknownTargetResourceConfigurations.Serialization.cs new file mode 100644 index 000000000000..95ed07c11d9b --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/UnknownTargetResourceConfigurations.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.LoadTesting +{ + internal partial class UnknownTargetResourceConfigurations : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + TargetResourceConfigurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetResourceConfigurations(document.RootElement, options); + } + + internal static UnknownTargetResourceConfigurations DeserializeUnknownTargetResourceConfigurations(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new ResourceKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownTargetResourceConfigurations(kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support writing '{options.Format}' format."); + } + } + + TargetResourceConfigurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetResourceConfigurations(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetResourceConfigurations)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownTargetResourceConfigurations FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownTargetResourceConfigurations(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/UnknownTargetResourceConfigurations.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/UnknownTargetResourceConfigurations.cs new file mode 100644 index 000000000000..b9bbc8047dc9 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Generated/UnknownTargetResourceConfigurations.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.LoadTesting +{ + /// Unknown version of TargetResourceConfigurations. + internal partial class UnknownTargetResourceConfigurations : TargetResourceConfigurations + { + /// Initializes a new instance of . + /// Kind of the resource for which the configurations apply. + /// Keeps track of any properties unknown to the library. + internal UnknownTargetResourceConfigurations(ResourceKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownTargetResourceConfigurations() + { + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/src/Properties/AssemblyInfo.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..7a7448111412 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.Developer.LoadTesting.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Azure.Developer.LoadTesting.Tests.csproj b/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Azure.Developer.LoadTesting.Tests.csproj new file mode 100644 index 000000000000..ed860a4c070a --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Azure.Developer.LoadTesting.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestAdministrationClient.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestAdministrationClient.cs new file mode 100644 index 000000000000..c54e78394da4 --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestAdministrationClient.cs @@ -0,0 +1,886 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.LoadTesting.Samples +{ + public partial class Samples_LoadTestAdministrationClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_CreateOrUpdateTest_CreateOrUpdateALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_LoadTest", + loadTestConfiguration = new + { + engineInstances = 6, + splitAllCSVs = true, + }, + passFailCriteria = new + { + passFailMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + clientMetric = "response_time_ms", + aggregate = "percentage", + condition = ">", + value = 20, + action = "continue", + } + }, + passFailServerMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + resourceId = "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + metricNamespace = "Microsoft.Compute/virtualMachines", + metricName = "Percentage CPU", + aggregation = "Average", + condition = ">", + value = 20, + action = "continue", + } + }, + }, + autoStopCriteria = new + { + autoStopDisabled = true, + errorRate = 70F, + errorRateTimeWindowInSeconds = 60, + }, + secrets = new + { + secret1 = new + { + value = "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + type = "AKV_SECRET_URI", + }, + }, + environmentVariables = new + { + envvar1 = "sampletext", + }, + subnetId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + keyvaultReferenceIdentityType = "UserAssigned", + keyvaultReferenceIdentityId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + metricsReferenceIdentityType = "UserAssigned", + metricsReferenceIdentityId = "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + engineBuiltInIdentityType = "UserAssigned", + engineBuiltInIdentityIds = new object[] + { +"/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + }, + }); + Response response = client.CreateOrUpdateTest("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_CreateOrUpdateTest_CreateOrUpdateALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_LoadTest", + loadTestConfiguration = new + { + engineInstances = 6, + splitAllCSVs = true, + }, + passFailCriteria = new + { + passFailMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + clientMetric = "response_time_ms", + aggregate = "percentage", + condition = ">", + value = 20, + action = "continue", + } + }, + passFailServerMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + resourceId = "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + metricNamespace = "Microsoft.Compute/virtualMachines", + metricName = "Percentage CPU", + aggregation = "Average", + condition = ">", + value = 20, + action = "continue", + } + }, + }, + autoStopCriteria = new + { + autoStopDisabled = true, + errorRate = 70F, + errorRateTimeWindowInSeconds = 60, + }, + secrets = new + { + secret1 = new + { + value = "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + type = "AKV_SECRET_URI", + }, + }, + environmentVariables = new + { + envvar1 = "sampletext", + }, + subnetId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + keyvaultReferenceIdentityType = "UserAssigned", + keyvaultReferenceIdentityId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + metricsReferenceIdentityType = "UserAssigned", + metricsReferenceIdentityId = "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + engineBuiltInIdentityType = "UserAssigned", + engineBuiltInIdentityIds = new object[] + { +"/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + }, + }); + Response response = await client.CreateOrUpdateTestAsync("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = client.CreateOrUpdateAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = await client.CreateOrUpdateAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = client.CreateOrUpdateServerMetricsConfig("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = await client.CreateOrUpdateServerMetricsConfigAsync("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_GetTest_GetALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTest("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_GetTest_GetALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_GetTest_GetALoadTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTest("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_GetTest_GetALoadTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestFile("12345678-1234-1234-1234-123456789012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestFileAsync("12345678-1234-1234-1234-123456789012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestFile("12345678-1234-1234-1234-123456789012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestFileAsync("12345678-1234-1234-1234-123456789012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_DeleteTestFile_DeleteAFileFromALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.DeleteTestFile("12345678-1234-1234-1234-123456789012", "app.jmx"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_DeleteTestFile_DeleteAFileFromALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.DeleteTestFileAsync("12345678-1234-1234-1234-123456789012", "app.jmx"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_DeleteTest_DeleteALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.DeleteTest("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_DeleteTest_DeleteALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.DeleteTestAsync("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_CreateOrUpdateTestProfile_CreateOrUpdateATestProfile() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_TestProfile", + testId = "12346-abcd-6789", + targetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp", + targetResourceConfigurations = new + { + kind = "FunctionsFlexConsumption", + configurations = new + { + config1 = new + { + instanceMemoryMB = 2048L, + httpConcurrency = 16L, + }, + config2 = new + { + instanceMemoryMB = 4096L, + httpConcurrency = 16L, + }, + }, + }, + }); + Response response = client.CreateOrUpdateTestProfile("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_CreateOrUpdateTestProfile_CreateOrUpdateATestProfile_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_TestProfile", + testId = "12346-abcd-6789", + targetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp", + targetResourceConfigurations = new + { + kind = "FunctionsFlexConsumption", + configurations = new + { + config1 = new + { + instanceMemoryMB = 2048L, + httpConcurrency = 16L, + }, + config2 = new + { + instanceMemoryMB = 4096L, + httpConcurrency = 16L, + }, + }, + }, + }); + Response response = await client.CreateOrUpdateTestProfileAsync("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_DeleteTestProfile_DeleteATestProfile() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.DeleteTestProfile("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_DeleteTestProfile_DeleteATestProfile_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.DeleteTestProfileAsync("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_GetTestProfile_GetATestProfile() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestProfile("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_GetTestProfile_GetATestProfile_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestProfileAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_GetTestProfile_GetATestProfile_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestProfile("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_GetTestProfile_GetATestProfile_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestProfileAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFiles_GetAllTestFiles() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (BinaryData item in client.GetTestFiles("12345678-1234-1234-1234-123456789012", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFiles_GetAllTestFiles_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (BinaryData item in client.GetTestFilesAsync("12345678-1234-1234-1234-123456789012", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFiles_GetAllTestFiles_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (TestFileInfo item in client.GetTestFiles("12345678-1234-1234-1234-123456789012")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFiles_GetAllTestFiles_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (TestFileInfo item in client.GetTestFilesAsync("12345678-1234-1234-1234-123456789012")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_GetTests_GetAllLoadTests() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (BinaryData item in client.GetTests(null, "Performance_LoadTest", null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_GetTests_GetAllLoadTests_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (BinaryData item in client.GetTestsAsync(null, "Performance_LoadTest", null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_GetTests_GetAllLoadTests_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (LoadTest item in client.GetTests()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_GetTests_GetAllLoadTests_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (LoadTest item in client.GetTestsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_GetTestProfiles_GetAllTestProfilesForTheSpecifiedFilters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (BinaryData item in client.GetTestProfiles(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_GetTestProfiles_GetAllTestProfilesForTheSpecifiedFilters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (BinaryData item in client.GetTestProfilesAsync(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_GetTestProfiles_GetAllTestProfilesForTheSpecifiedFilters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (TestProfile item in client.GetTestProfiles()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_GetTestProfiles_GetAllTestProfilesForTheSpecifiedFilters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (TestProfile item in client.GetTestProfilesAsync()) + { + } + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestRunClient.cs b/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestRunClient.cs new file mode 100644 index 000000000000..886c16ecf87e --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestRunClient.cs @@ -0,0 +1,944 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.LoadTesting.Samples +{ + public partial class Samples_LoadTestRunClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = client.CreateOrUpdateAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = await client.CreateOrUpdateAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = client.CreateOrUpdateServerMetricsConfig("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = await client.CreateOrUpdateServerMetricsConfigAsync("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_DeleteTestRun_DeleteALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.DeleteTestRun("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_DeleteTestRun_DeleteALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.DeleteTestRunAsync("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_GetTestRun_GetALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_GetTestRun_GetALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_GetTestRun_GetALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_GetTestRun_GetALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRunFile("12316678-1234-1234-1234-122451189012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunFileAsync("12316678-1234-1234-1234-122451189012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRunFile("12316678-1234-1234-1234-122451189012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunFileAsync("12316678-1234-1234-1234-122451189012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricDefinitions("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricDefinitionsAsync("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricDefinitions("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricDefinitionsAsync("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricNamespaces("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricNamespacesAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricNamespaces("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricNamespacesAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestRun_StopTestRunByName() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestRun_StopTestRunByName_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestRun_StopTestRunByName_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestRun_StopTestRunByName_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_DeleteTestProfileRun_DeletesATestProfileRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.DeleteTestProfileRun("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_DeleteTestProfileRun_DeletesATestProfileRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.DeleteTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestProfileRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestProfileRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (BinaryData item in client.GetMetricDimensionValues("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", "PT1H", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (BinaryData item in client.GetMetricDimensionValuesAsync("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", "PT1H", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (string item in client.GetMetricDimensionValues("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (string item in client.GetMetricDimensionValuesAsync("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filters = new object[] + { +new +{ +name = "SamplerName", +values = new object[] +{ +"HTTP Request" +}, +} + }, + }); + foreach (BinaryData item in client.GetMetrics("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", content)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filters = new object[] + { +new +{ +name = "SamplerName", +values = new object[] +{ +"HTTP Request" +}, +} + }, + }); + await foreach (BinaryData item in client.GetMetricsAsync("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", content)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (TimeSeriesElement item in client.GetMetrics("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (TimeSeriesElement item in client.GetMetricsAsync("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_GetTestRuns_ListTestRuns() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (BinaryData item in client.GetTestRuns(null, "Performance_LoadTest_Run1", "12345678-1234-1234-1234-123456789012", DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), "DONE,EXECUTING", null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_GetTestRuns_ListTestRuns_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (BinaryData item in client.GetTestRunsAsync(null, "Performance_LoadTest_Run1", "12345678-1234-1234-1234-123456789012", DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), DateTimeOffset.Parse("2021-12-05T16:43:48.805Z"), "DONE,EXECUTING", null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_GetTestRuns_ListTestRuns_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (LoadTestRun item in client.GetTestRuns()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_GetTestRuns_ListTestRuns_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (LoadTestRun item in client.GetTestRunsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRuns_GetAllTestProfileRunsForTheSpecifiedFilters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (BinaryData item in client.GetTestProfileRuns(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRuns_GetAllTestProfileRunsForTheSpecifiedFilters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (BinaryData item in client.GetTestProfileRunsAsync(null, DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:00:46.072Z"), DateTimeOffset.Parse("2024-05-01T16:50:46.072Z"), null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRuns_GetAllTestProfileRunsForTheSpecifiedFilters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (TestProfileRun item in client.GetTestProfileRuns()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRuns_GetAllTestProfileRunsForTheSpecifiedFilters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (TestProfileRun item in client.GetTestProfileRunsAsync()) + { + } + } + } +} diff --git a/sdk/loadtesting/Azure.Developer.LoadTesting/tsp-location.yaml b/sdk/loadtesting/Azure.Developer.LoadTesting/tsp-location.yaml new file mode 100644 index 000000000000..9baf59bf2d7f --- /dev/null +++ b/sdk/loadtesting/Azure.Developer.LoadTesting/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/loadtestservice/LoadTestService +commit: f79d4ed573ec12a63917b01e54baeaa52a914f3f +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/loadtesting/ci.yml b/sdk/loadtesting/ci.yml new file mode 100644 index 000000000000..5046481ec78c --- /dev/null +++ b/sdk/loadtesting/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/loadtesting + - sdk/loadtesting/ci.yml + - sdk/loadtesting/Azure.Developer.LoadTesting + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/loadtesting + - sdk/loadtesting/ci.yml + - sdk/loadtesting/Azure.Developer.LoadTesting + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: loadtesting + ArtifactName: packages + Artifacts: + - name: Azure.Developer.LoadTesting + safeName: AzureDeveloperLoadTesting