diff --git a/src/apic-extension/azext_apic_extension/_help.py b/src/apic-extension/azext_apic_extension/_help.py index e57c940f8f..d457528006 100644 --- a/src/apic-extension/azext_apic_extension/_help.py +++ b/src/apic-extension/azext_apic_extension/_help.py @@ -31,4 +31,7 @@ text: | az apic api register -g api-center-test -n contosoeuap --api-location "examples/cli-examples/spec-examples/openai.json" --environment-id public az apic api register -g api-center-test -n contosoeuap --api-location "examples/cli-examples/spec-examples/openai.yml" --environment-id public + - name: Register api by providing spec url. + text: | + az apic api register -g api-center-test -n contosoeuap --api-location "https://petstore.swagger.io/v2/swagger.json" --environment-id public """ diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index bbc65d3bd9..501da1f4a1 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -162,26 +162,47 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_i # Load the JSON file if api_location: - # TODO Future Confirm its a file and not link - with open(str(api_location), 'rb') as f: - rawdata = f.read() - result = chardet.detect(rawdata) - encoding = result['encoding'] - - # TODO - read other file types later value = None - if str(api_location).endswith('.yaml') or str(api_location).endswith('.yml'): - with open(str(api_location), 'r', encoding=encoding) as f: - content = f.read() - data = yaml.safe_load(content) - if data: - value = content - if (str(api_location).endswith('.json')): - with open(str(api_location), 'r', encoding=encoding) as f: - content = f.read() - data = json.loads(content) - if data: - value = content + # Read the spec content from URL + if str(api_location).startswith('https://') or str(api_location).startswith('http://'): + try: + # Fetch the content from the URL + response = requests.get(api_location) + # Raise an error for bad status codes + response.raise_for_status() + # Try to parse the content as JSON + try: + data = json.loads(response.content) + except json.JSONDecodeError: + try: + # If JSON parsing fails, try to parse as YAML + data = yaml.safe_load(response.content) + except yaml.YAMLError as e: + logger.error("Error parsing data from %s: %s", api_location, e) + data = None + # If we could parse the content(json or yaml), convert it to a json format string + value = json.dumps(data) if data else None + except requests.exceptions.RequestException as e: + logger.error("Error fetching data from %s: %s", api_location, e) + value = None + else: + # Confirm its a file and not link + with open(str(api_location), 'rb') as f: + rawdata = f.read() + result = chardet.detect(rawdata) + encoding = result['encoding'] + + # TODO - read other file types later + if str(api_location).endswith('.yaml') or str(api_location).endswith('.yml'): + with open(str(api_location), 'r', encoding=encoding) as f: + content = f.read() + data = yaml.safe_load(content) + value = content if data else None + if (str(api_location).endswith('.json')): + with open(str(api_location), 'r', encoding=encoding) as f: + content = f.read() + data = json.loads(content) + value = content if data else None # If we could not read the file, return error if value is None: diff --git a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_register_with_json_spec_from_url.yaml b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_register_with_json_spec_from_url.yaml new file mode 100644 index 0000000000..95a4ce3907 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_register_with_json_spec_from_url.yaml @@ -0,0 +1,764 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.3 + method: GET + uri: https://petstore.swagger.io/v2/swagger.json + response: + body: + string: '{"swagger":"2.0","info":{"description":"This is a sample server Petstore + server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) + or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, + you can use the api key `special-key` to test the authorization filters.","version":"1.0.7","title":"Swagger + Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache + 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything + about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access + to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find + out more about our store","url":"http://swagger.io"}}],"schemes":["https","http"],"paths":{"/pet/{petId}/uploadImage":{"post":{"tags":["pet"],"summary":"uploads + an image","description":"","operationId":"uploadFile","consumes":["multipart/form-data"],"produces":["application/json"],"parameters":[{"name":"petId","in":"path","description":"ID + of pet to update","required":true,"type":"integer","format":"int64"},{"name":"additionalMetadata","in":"formData","description":"Additional + data to pass to server","required":false,"type":"string"},{"name":"file","in":"formData","description":"file + to upload","required":false,"type":"file"}],"responses":{"200":{"description":"successful + operation","schema":{"$ref":"#/definitions/ApiResponse"}}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet":{"post":{"tags":["pet"],"summary":"Add + a new pet to the store","description":"","operationId":"addPet","consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"parameters":[{"in":"body","name":"body","description":"Pet + object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"405":{"description":"Invalid + input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"put":{"tags":["pet"],"summary":"Update + an existing pet","description":"","operationId":"updatePet","consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"parameters":[{"in":"body","name":"body","description":"Pet + object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"400":{"description":"Invalid + ID supplied"},"404":{"description":"Pet not found"},"405":{"description":"Validation + exception"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByStatus":{"get":{"tags":["pet"],"summary":"Finds + Pets by status","description":"Multiple status values can be provided with + comma separated strings","operationId":"findPetsByStatus","produces":["application/json","application/xml"],"parameters":[{"name":"status","in":"query","description":"Status + values that need to be considered for filter","required":true,"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available"},"collectionFormat":"multi"}],"responses":{"200":{"description":"successful + operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid + status value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByTags":{"get":{"tags":["pet"],"summary":"Finds + Pets by tags","description":"Multiple tags can be provided with comma separated + strings. Use tag1, tag2, tag3 for testing.","operationId":"findPetsByTags","produces":["application/json","application/xml"],"parameters":[{"name":"tags","in":"query","description":"Tags + to filter by","required":true,"type":"array","items":{"type":"string"},"collectionFormat":"multi"}],"responses":{"200":{"description":"successful + operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid + tag value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}],"deprecated":true}},"/pet/{petId}":{"get":{"tags":["pet"],"summary":"Find + pet by ID","description":"Returns a single pet","operationId":"getPetById","produces":["application/json","application/xml"],"parameters":[{"name":"petId","in":"path","description":"ID + of pet to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"successful + operation","schema":{"$ref":"#/definitions/Pet"}},"400":{"description":"Invalid + ID supplied"},"404":{"description":"Pet not found"}},"security":[{"api_key":[]}]},"post":{"tags":["pet"],"summary":"Updates + a pet in the store with form data","description":"","operationId":"updatePetWithForm","consumes":["application/x-www-form-urlencoded"],"produces":["application/json","application/xml"],"parameters":[{"name":"petId","in":"path","description":"ID + of pet that needs to be updated","required":true,"type":"integer","format":"int64"},{"name":"name","in":"formData","description":"Updated + name of the pet","required":false,"type":"string"},{"name":"status","in":"formData","description":"Updated + status of the pet","required":false,"type":"string"}],"responses":{"405":{"description":"Invalid + input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"delete":{"tags":["pet"],"summary":"Deletes + a pet","description":"","operationId":"deletePet","produces":["application/json","application/xml"],"parameters":[{"name":"api_key","in":"header","required":false,"type":"string"},{"name":"petId","in":"path","description":"Pet + id to delete","required":true,"type":"integer","format":"int64"}],"responses":{"400":{"description":"Invalid + ID supplied"},"404":{"description":"Pet not found"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/store/inventory":{"get":{"tags":["store"],"summary":"Returns + pet inventories by status","description":"Returns a map of status codes to + quantities","operationId":"getInventory","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful + operation","schema":{"type":"object","additionalProperties":{"type":"integer","format":"int32"}}}},"security":[{"api_key":[]}]}},"/store/order":{"post":{"tags":["store"],"summary":"Place + an order for a pet","description":"","operationId":"placeOrder","consumes":["application/json"],"produces":["application/json","application/xml"],"parameters":[{"in":"body","name":"body","description":"order + placed for purchasing the pet","required":true,"schema":{"$ref":"#/definitions/Order"}}],"responses":{"200":{"description":"successful + operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid + Order"}}}},"/store/order/{orderId}":{"get":{"tags":["store"],"summary":"Find + purchase order by ID","description":"For valid response try integer IDs with + value >= 1 and <= 10. Other values will generated exceptions","operationId":"getOrderById","produces":["application/json","application/xml"],"parameters":[{"name":"orderId","in":"path","description":"ID + of pet that needs to be fetched","required":true,"type":"integer","maximum":10,"minimum":1,"format":"int64"}],"responses":{"200":{"description":"successful + operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid + ID supplied"},"404":{"description":"Order not found"}}},"delete":{"tags":["store"],"summary":"Delete + purchase order by ID","description":"For valid response try integer IDs with + positive integer value. Negative or non-integer values will generate API errors","operationId":"deleteOrder","produces":["application/json","application/xml"],"parameters":[{"name":"orderId","in":"path","description":"ID + of the order that needs to be deleted","required":true,"type":"integer","minimum":1,"format":"int64"}],"responses":{"400":{"description":"Invalid + ID supplied"},"404":{"description":"Order not found"}}}},"/user/createWithList":{"post":{"tags":["user"],"summary":"Creates + list of users with given input array","description":"","operationId":"createUsersWithListInput","consumes":["application/json"],"produces":["application/json","application/xml"],"parameters":[{"in":"body","name":"body","description":"List + of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful + operation"}}}},"/user/{username}":{"get":{"tags":["user"],"summary":"Get user + by user name","description":"","operationId":"getUserByName","produces":["application/json","application/xml"],"parameters":[{"name":"username","in":"path","description":"The + name that needs to be fetched. Use user1 for testing. ","required":true,"type":"string"}],"responses":{"200":{"description":"successful + operation","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Invalid + username supplied"},"404":{"description":"User not found"}}},"put":{"tags":["user"],"summary":"Updated + user","description":"This can only be done by the logged in user.","operationId":"updateUser","consumes":["application/json"],"produces":["application/json","application/xml"],"parameters":[{"name":"username","in":"path","description":"name + that need to be updated","required":true,"type":"string"},{"in":"body","name":"body","description":"Updated + user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"400":{"description":"Invalid + user supplied"},"404":{"description":"User not found"}}},"delete":{"tags":["user"],"summary":"Delete + user","description":"This can only be done by the logged in user.","operationId":"deleteUser","produces":["application/json","application/xml"],"parameters":[{"name":"username","in":"path","description":"The + name that needs to be deleted","required":true,"type":"string"}],"responses":{"400":{"description":"Invalid + username supplied"},"404":{"description":"User not found"}}}},"/user/login":{"get":{"tags":["user"],"summary":"Logs + user into the system","description":"","operationId":"loginUser","produces":["application/json","application/xml"],"parameters":[{"name":"username","in":"query","description":"The + user name for login","required":true,"type":"string"},{"name":"password","in":"query","description":"The + password for login in clear text","required":true,"type":"string"}],"responses":{"200":{"description":"successful + operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date + in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls + per hour allowed by the user"}},"schema":{"type":"string"}},"400":{"description":"Invalid + username/password supplied"}}}},"/user/logout":{"get":{"tags":["user"],"summary":"Logs + out current logged in user session","description":"","operationId":"logoutUser","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful + operation"}}}},"/user/createWithArray":{"post":{"tags":["user"],"summary":"Creates + list of users with given input array","description":"","operationId":"createUsersWithArrayInput","consumes":["application/json"],"produces":["application/json","application/xml"],"parameters":[{"in":"body","name":"body","description":"List + of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful + operation"}}}},"/user":{"post":{"tags":["user"],"summary":"Create user","description":"This + can only be done by the logged in user.","operationId":"createUser","consumes":["application/json"],"produces":["application/json","application/xml"],"parameters":[{"in":"body","name":"body","description":"Created + user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"default":{"description":"successful + operation"}}}}},"securityDefinitions":{"api_key":{"type":"apiKey","name":"api_key","in":"header"},"petstore_auth":{"type":"oauth2","authorizationUrl":"https://petstore.swagger.io/oauth/authorize","flow":"implicit","scopes":{"read:pets":"read + your pets","write:pets":"modify pets in your account"}}},"definitions":{"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"type":{"type":"string"},"message":{"type":"string"}}},"Category":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"xml":{"name":"Category"}},"Pet":{"type":"object","required":["name","photoUrls"],"properties":{"id":{"type":"integer","format":"int64"},"category":{"$ref":"#/definitions/Category"},"name":{"type":"string","example":"doggie"},"photoUrls":{"type":"array","xml":{"wrapped":true},"items":{"type":"string","xml":{"name":"photoUrl"}}},"tags":{"type":"array","xml":{"wrapped":true},"items":{"xml":{"name":"tag"},"$ref":"#/definitions/Tag"}},"status":{"type":"string","description":"pet + status in the store","enum":["available","pending","sold"]}},"xml":{"name":"Pet"}},"Tag":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"xml":{"name":"Tag"}},"Order":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"petId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32"},"shipDate":{"type":"string","format":"date-time"},"status":{"type":"string","description":"Order + Status","enum":["placed","approved","delivered"]},"complete":{"type":"boolean"}},"xml":{"name":"Order"}},"User":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"userStatus":{"type":"integer","format":"int32","description":"User + Status"}},"xml":{"name":"User"}}},"externalDocs":{"description":"Find out + more about Swagger","url":"http://swagger.io"}}' + headers: + access-control-allow-headers: + - Content-Type, api_key, Authorization + access-control-allow-methods: + - GET, POST, DELETE, PUT + access-control-allow-origin: + - '*' + connection: + - keep-alive + content-type: + - application/json + date: + - Fri, 11 Oct 2024 02:44:04 GMT + server: + - Jetty(9.2.9.v20150224) + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: '{"properties": {"contacts": [{"email": "apiteam@swagger.io"}], "description": + "This is a sample server Petstore server. You can find out more about Swagger + at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For + this sample, you can use the api key `special-key` to test the authorization + filters.", "externalDocumentation": [{"description": "Find out more about Swagger", + "title": "Title", "url": "http://swagger.io"}], "kind": "rest", "license": {"name": + "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html"}, "title": + "Swagger Petstore"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '611' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis","properties":{"title":"Swagger + Petstore","description":"This is a sample server Petstore server. You can + find out more about Swagger at [http://swagger.io](http://swagger.io) or on + [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you + can use the api key `special-key` to test the authorization filters.","kind":"rest","license":{"name":"Apache + 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"externalDocumentation":[{"title":"Title","description":"Find + out more about Swagger","url":"http://swagger.io"}],"contacts":[{"email":"apiteam@swagger.io"}],"customProperties":{}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore","name":"swaggerpetstore","systemData":{"createdAt":"2024-10-11T02:44:06.2576704Z","lastModifiedAt":"2024-10-11T02:44:06.2576691Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '976' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:06 GMT + etag: + - f1002d9e-0000-0100-0000-670890f60000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: 20388713EC5E499B9A732FC501F0111C Ref B: MAA201060513049 Ref C: 2024-10-11T02:44:04Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"lifecycleStage": "design", "title": "1-0-7"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '62' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions","properties":{"title":"1-0-7","lifecycleStage":"design"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7","name":"1-0-7","systemData":{"createdAt":"2024-10-11T02:44:09.0438512Z","lastModifiedAt":"2024-10-11T02:44:09.0438503Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '436' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:08 GMT + etag: + - 9b00b547-0000-0100-0000-670890f90000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: 61CD12AEE71F4C3F9E348ADC1CFC175F Ref B: MAA201060516025 Ref C: 2024-10-11T02:44:07Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "This is a sample server Petstore server. You + can find out more about Swagger at [http://swagger.io](http://swagger.io) or + on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you + can use the api key `special-key` to test the authorization filters.", "title": + "openapi"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '325' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions/definitions","properties":{"title":"openapi","description":"This + is a sample server Petstore server. You can find out more about Swagger at + [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For + this sample, you can use the api key `special-key` to test the authorization + filters."},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi","name":"openapi","systemData":{"createdAt":"2024-10-11T02:44:11.5734667Z","lastModifiedAt":"2024-10-11T02:44:11.5734654Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '733' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:11 GMT + etag: + - 9f00b131-0000-0100-0000-670890fb0000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: B693343E3F9546AC8928B83E360FF3CB Ref B: MAA201060514033 Ref C: 2024-10-11T02:44:09Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"format": "inline", "specification": {"name": "openapi", "version": "2-0"}, + "value": "{\"swagger\": \"2.0\", \"info\": {\"description\": \"This is a sample + server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) + or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, + you can use the api key `special-key` to test the authorization filters.\", + \"version\": \"1.0.7\", \"title\": \"Swagger Petstore\", \"termsOfService\": + \"http://swagger.io/terms/\", \"contact\": {\"email\": \"apiteam@swagger.io\"}, + \"license\": {\"name\": \"Apache 2.0\", \"url\": \"http://www.apache.org/licenses/LICENSE-2.0.html\"}}, + \"host\": \"petstore.swagger.io\", \"basePath\": \"/v2\", \"tags\": [{\"name\": + \"pet\", \"description\": \"Everything about your Pets\", \"externalDocs\": + {\"description\": \"Find out more\", \"url\": \"http://swagger.io\"}}, {\"name\": + \"store\", \"description\": \"Access to Petstore orders\"}, {\"name\": \"user\", + \"description\": \"Operations about user\", \"externalDocs\": {\"description\": + \"Find out more about our store\", \"url\": \"http://swagger.io\"}}], \"schemes\": + [\"https\", \"http\"], \"paths\": {\"/pet/{petId}/uploadImage\": {\"post\": + {\"tags\": [\"pet\"], \"summary\": \"uploads an image\", \"description\": \"\", + \"operationId\": \"uploadFile\", \"consumes\": [\"multipart/form-data\"], \"produces\": + [\"application/json\"], \"parameters\": [{\"name\": \"petId\", \"in\": \"path\", + \"description\": \"ID of pet to update\", \"required\": true, \"type\": \"integer\", + \"format\": \"int64\"}, {\"name\": \"additionalMetadata\", \"in\": \"formData\", + \"description\": \"Additional data to pass to server\", \"required\": false, + \"type\": \"string\"}, {\"name\": \"file\", \"in\": \"formData\", \"description\": + \"file to upload\", \"required\": false, \"type\": \"file\"}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"$ref\": + \"#/definitions/ApiResponse\"}}}, \"security\": [{\"petstore_auth\": [\"write:pets\", + \"read:pets\"]}]}}, \"/pet\": {\"post\": {\"tags\": [\"pet\"], \"summary\": + \"Add a new pet to the store\", \"description\": \"\", \"operationId\": \"addPet\", + \"consumes\": [\"application/json\", \"application/xml\"], \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"in\": \"body\", \"name\": \"body\", + \"description\": \"Pet object that needs to be added to the store\", \"required\": + true, \"schema\": {\"$ref\": \"#/definitions/Pet\"}}], \"responses\": {\"405\": + {\"description\": \"Invalid input\"}}, \"security\": [{\"petstore_auth\": [\"write:pets\", + \"read:pets\"]}]}, \"put\": {\"tags\": [\"pet\"], \"summary\": \"Update an existing + pet\", \"description\": \"\", \"operationId\": \"updatePet\", \"consumes\": + [\"application/json\", \"application/xml\"], \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"in\": \"body\", \"name\": \"body\", + \"description\": \"Pet object that needs to be added to the store\", \"required\": + true, \"schema\": {\"$ref\": \"#/definitions/Pet\"}}], \"responses\": {\"400\": + {\"description\": \"Invalid ID supplied\"}, \"404\": {\"description\": \"Pet + not found\"}, \"405\": {\"description\": \"Validation exception\"}}, \"security\": + [{\"petstore_auth\": [\"write:pets\", \"read:pets\"]}]}}, \"/pet/findByStatus\": + {\"get\": {\"tags\": [\"pet\"], \"summary\": \"Finds Pets by status\", \"description\": + \"Multiple status values can be provided with comma separated strings\", \"operationId\": + \"findPetsByStatus\", \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"name\": \"status\", \"in\": \"query\", \"description\": + \"Status values that need to be considered for filter\", \"required\": true, + \"type\": \"array\", \"items\": {\"type\": \"string\", \"enum\": [\"available\", + \"pending\", \"sold\"], \"default\": \"available\"}, \"collectionFormat\": \"multi\"}], + \"responses\": {\"200\": {\"description\": \"successful operation\", \"schema\": + {\"type\": \"array\", \"items\": {\"$ref\": \"#/definitions/Pet\"}}}, \"400\": + {\"description\": \"Invalid status value\"}}, \"security\": [{\"petstore_auth\": + [\"write:pets\", \"read:pets\"]}]}}, \"/pet/findByTags\": {\"get\": {\"tags\": + [\"pet\"], \"summary\": \"Finds Pets by tags\", \"description\": \"Multiple + tags can be provided with comma separated strings. Use tag1, tag2, tag3 for + testing.\", \"operationId\": \"findPetsByTags\", \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"name\": \"tags\", \"in\": \"query\", + \"description\": \"Tags to filter by\", \"required\": true, \"type\": \"array\", + \"items\": {\"type\": \"string\"}, \"collectionFormat\": \"multi\"}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"type\": + \"array\", \"items\": {\"$ref\": \"#/definitions/Pet\"}}}, \"400\": {\"description\": + \"Invalid tag value\"}}, \"security\": [{\"petstore_auth\": [\"write:pets\", + \"read:pets\"]}], \"deprecated\": true}}, \"/pet/{petId}\": {\"get\": {\"tags\": + [\"pet\"], \"summary\": \"Find pet by ID\", \"description\": \"Returns a single + pet\", \"operationId\": \"getPetById\", \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"name\": \"petId\", \"in\": \"path\", + \"description\": \"ID of pet to return\", \"required\": true, \"type\": \"integer\", + \"format\": \"int64\"}], \"responses\": {\"200\": {\"description\": \"successful + operation\", \"schema\": {\"$ref\": \"#/definitions/Pet\"}}, \"400\": {\"description\": + \"Invalid ID supplied\"}, \"404\": {\"description\": \"Pet not found\"}}, \"security\": + [{\"api_key\": []}]}, \"post\": {\"tags\": [\"pet\"], \"summary\": \"Updates + a pet in the store with form data\", \"description\": \"\", \"operationId\": + \"updatePetWithForm\", \"consumes\": [\"application/x-www-form-urlencoded\"], + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"petId\", \"in\": \"path\", \"description\": \"ID of pet that needs to be updated\", + \"required\": true, \"type\": \"integer\", \"format\": \"int64\"}, {\"name\": + \"name\", \"in\": \"formData\", \"description\": \"Updated name of the pet\", + \"required\": false, \"type\": \"string\"}, {\"name\": \"status\", \"in\": \"formData\", + \"description\": \"Updated status of the pet\", \"required\": false, \"type\": + \"string\"}], \"responses\": {\"405\": {\"description\": \"Invalid input\"}}, + \"security\": [{\"petstore_auth\": [\"write:pets\", \"read:pets\"]}]}, \"delete\": + {\"tags\": [\"pet\"], \"summary\": \"Deletes a pet\", \"description\": \"\", + \"operationId\": \"deletePet\", \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"name\": \"api_key\", \"in\": \"header\", \"required\": false, + \"type\": \"string\"}, {\"name\": \"petId\", \"in\": \"path\", \"description\": + \"Pet id to delete\", \"required\": true, \"type\": \"integer\", \"format\": + \"int64\"}], \"responses\": {\"400\": {\"description\": \"Invalid ID supplied\"}, + \"404\": {\"description\": \"Pet not found\"}}, \"security\": [{\"petstore_auth\": + [\"write:pets\", \"read:pets\"]}]}}, \"/store/inventory\": {\"get\": {\"tags\": + [\"store\"], \"summary\": \"Returns pet inventories by status\", \"description\": + \"Returns a map of status codes to quantities\", \"operationId\": \"getInventory\", + \"produces\": [\"application/json\"], \"parameters\": [], \"responses\": {\"200\": + {\"description\": \"successful operation\", \"schema\": {\"type\": \"object\", + \"additionalProperties\": {\"type\": \"integer\", \"format\": \"int32\"}}}}, + \"security\": [{\"api_key\": []}]}}, \"/store/order\": {\"post\": {\"tags\": + [\"store\"], \"summary\": \"Place an order for a pet\", \"description\": \"\", + \"operationId\": \"placeOrder\", \"consumes\": [\"application/json\"], \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [{\"in\": \"body\", + \"name\": \"body\", \"description\": \"order placed for purchasing the pet\", + \"required\": true, \"schema\": {\"$ref\": \"#/definitions/Order\"}}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"$ref\": + \"#/definitions/Order\"}}, \"400\": {\"description\": \"Invalid Order\"}}}}, + \"/store/order/{orderId}\": {\"get\": {\"tags\": [\"store\"], \"summary\": \"Find + purchase order by ID\", \"description\": \"For valid response try integer IDs + with value >= 1 and <= 10. Other values will generated exceptions\", \"operationId\": + \"getOrderById\", \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"name\": \"orderId\", \"in\": \"path\", \"description\": + \"ID of pet that needs to be fetched\", \"required\": true, \"type\": \"integer\", + \"maximum\": 10, \"minimum\": 1, \"format\": \"int64\"}], \"responses\": {\"200\": + {\"description\": \"successful operation\", \"schema\": {\"$ref\": \"#/definitions/Order\"}}, + \"400\": {\"description\": \"Invalid ID supplied\"}, \"404\": {\"description\": + \"Order not found\"}}}, \"delete\": {\"tags\": [\"store\"], \"summary\": \"Delete + purchase order by ID\", \"description\": \"For valid response try integer IDs + with positive integer value. Negative or non-integer values will generate API + errors\", \"operationId\": \"deleteOrder\", \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"name\": \"orderId\", \"in\": \"path\", + \"description\": \"ID of the order that needs to be deleted\", \"required\": + true, \"type\": \"integer\", \"minimum\": 1, \"format\": \"int64\"}], \"responses\": + {\"400\": {\"description\": \"Invalid ID supplied\"}, \"404\": {\"description\": + \"Order not found\"}}}}, \"/user/createWithList\": {\"post\": {\"tags\": [\"user\"], + \"summary\": \"Creates list of users with given input array\", \"description\": + \"\", \"operationId\": \"createUsersWithListInput\", \"consumes\": [\"application/json\"], + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"in\": + \"body\", \"name\": \"body\", \"description\": \"List of user object\", \"required\": + true, \"schema\": {\"type\": \"array\", \"items\": {\"$ref\": \"#/definitions/User\"}}}], + \"responses\": {\"default\": {\"description\": \"successful operation\"}}}}, + \"/user/{username}\": {\"get\": {\"tags\": [\"user\"], \"summary\": \"Get user + by user name\", \"description\": \"\", \"operationId\": \"getUserByName\", \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": \"username\", + \"in\": \"path\", \"description\": \"The name that needs to be fetched. Use + user1 for testing. \", \"required\": true, \"type\": \"string\"}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"$ref\": + \"#/definitions/User\"}}, \"400\": {\"description\": \"Invalid username supplied\"}, + \"404\": {\"description\": \"User not found\"}}}, \"put\": {\"tags\": [\"user\"], + \"summary\": \"Updated user\", \"description\": \"This can only be done by the + logged in user.\", \"operationId\": \"updateUser\", \"consumes\": [\"application/json\"], + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"username\", \"in\": \"path\", \"description\": \"name that need to be updated\", + \"required\": true, \"type\": \"string\"}, {\"in\": \"body\", \"name\": \"body\", + \"description\": \"Updated user object\", \"required\": true, \"schema\": {\"$ref\": + \"#/definitions/User\"}}], \"responses\": {\"400\": {\"description\": \"Invalid + user supplied\"}, \"404\": {\"description\": \"User not found\"}}}, \"delete\": + {\"tags\": [\"user\"], \"summary\": \"Delete user\", \"description\": \"This + can only be done by the logged in user.\", \"operationId\": \"deleteUser\", + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"username\", \"in\": \"path\", \"description\": \"The name that needs to be + deleted\", \"required\": true, \"type\": \"string\"}], \"responses\": {\"400\": + {\"description\": \"Invalid username supplied\"}, \"404\": {\"description\": + \"User not found\"}}}}, \"/user/login\": {\"get\": {\"tags\": [\"user\"], \"summary\": + \"Logs user into the system\", \"description\": \"\", \"operationId\": \"loginUser\", + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"username\", \"in\": \"query\", \"description\": \"The user name for login\", + \"required\": true, \"type\": \"string\"}, {\"name\": \"password\", \"in\": + \"query\", \"description\": \"The password for login in clear text\", \"required\": + true, \"type\": \"string\"}], \"responses\": {\"200\": {\"description\": \"successful + operation\", \"headers\": {\"X-Expires-After\": {\"type\": \"string\", \"format\": + \"date-time\", \"description\": \"date in UTC when token expires\"}, \"X-Rate-Limit\": + {\"type\": \"integer\", \"format\": \"int32\", \"description\": \"calls per + hour allowed by the user\"}}, \"schema\": {\"type\": \"string\"}}, \"400\": + {\"description\": \"Invalid username/password supplied\"}}}}, \"/user/logout\": + {\"get\": {\"tags\": [\"user\"], \"summary\": \"Logs out current logged in user + session\", \"description\": \"\", \"operationId\": \"logoutUser\", \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [], \"responses\": + {\"default\": {\"description\": \"successful operation\"}}}}, \"/user/createWithArray\": + {\"post\": {\"tags\": [\"user\"], \"summary\": \"Creates list of users with + given input array\", \"description\": \"\", \"operationId\": \"createUsersWithArrayInput\", + \"consumes\": [\"application/json\"], \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"in\": \"body\", \"name\": \"body\", \"description\": \"List + of user object\", \"required\": true, \"schema\": {\"type\": \"array\", \"items\": + {\"$ref\": \"#/definitions/User\"}}}], \"responses\": {\"default\": {\"description\": + \"successful operation\"}}}}, \"/user\": {\"post\": {\"tags\": [\"user\"], \"summary\": + \"Create user\", \"description\": \"This can only be done by the logged in user.\", + \"operationId\": \"createUser\", \"consumes\": [\"application/json\"], \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [{\"in\": \"body\", + \"name\": \"body\", \"description\": \"Created user object\", \"required\": + true, \"schema\": {\"$ref\": \"#/definitions/User\"}}], \"responses\": {\"default\": + {\"description\": \"successful operation\"}}}}}, \"securityDefinitions\": {\"api_key\": + {\"type\": \"apiKey\", \"name\": \"api_key\", \"in\": \"header\"}, \"petstore_auth\": + {\"type\": \"oauth2\", \"authorizationUrl\": \"https://petstore.swagger.io/oauth/authorize\", + \"flow\": \"implicit\", \"scopes\": {\"read:pets\": \"read your pets\", \"write:pets\": + \"modify pets in your account\"}}}, \"definitions\": {\"ApiResponse\": {\"type\": + \"object\", \"properties\": {\"code\": {\"type\": \"integer\", \"format\": \"int32\"}, + \"type\": {\"type\": \"string\"}, \"message\": {\"type\": \"string\"}}}, \"Category\": + {\"type\": \"object\", \"properties\": {\"id\": {\"type\": \"integer\", \"format\": + \"int64\"}, \"name\": {\"type\": \"string\"}}, \"xml\": {\"name\": \"Category\"}}, + \"Pet\": {\"type\": \"object\", \"required\": [\"name\", \"photoUrls\"], \"properties\": + {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"category\": {\"$ref\": + \"#/definitions/Category\"}, \"name\": {\"type\": \"string\", \"example\": \"doggie\"}, + \"photoUrls\": {\"type\": \"array\", \"xml\": {\"wrapped\": true}, \"items\": + {\"type\": \"string\", \"xml\": {\"name\": \"photoUrl\"}}}, \"tags\": {\"type\": + \"array\", \"xml\": {\"wrapped\": true}, \"items\": {\"xml\": {\"name\": \"tag\"}, + \"$ref\": \"#/definitions/Tag\"}}, \"status\": {\"type\": \"string\", \"description\": + \"pet status in the store\", \"enum\": [\"available\", \"pending\", \"sold\"]}}, + \"xml\": {\"name\": \"Pet\"}}, \"Tag\": {\"type\": \"object\", \"properties\": + {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"name\": {\"type\": + \"string\"}}, \"xml\": {\"name\": \"Tag\"}}, \"Order\": {\"type\": \"object\", + \"properties\": {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"petId\": + {\"type\": \"integer\", \"format\": \"int64\"}, \"quantity\": {\"type\": \"integer\", + \"format\": \"int32\"}, \"shipDate\": {\"type\": \"string\", \"format\": \"date-time\"}, + \"status\": {\"type\": \"string\", \"description\": \"Order Status\", \"enum\": + [\"placed\", \"approved\", \"delivered\"]}, \"complete\": {\"type\": \"boolean\"}}, + \"xml\": {\"name\": \"Order\"}}, \"User\": {\"type\": \"object\", \"properties\": + {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"username\": {\"type\": + \"string\"}, \"firstName\": {\"type\": \"string\"}, \"lastName\": {\"type\": + \"string\"}, \"email\": {\"type\": \"string\"}, \"password\": {\"type\": \"string\"}, + \"phone\": {\"type\": \"string\"}, \"userStatus\": {\"type\": \"integer\", \"format\": + \"int32\", \"description\": \"User Status\"}}, \"xml\": {\"name\": \"User\"}}}, + \"externalDocs\": {\"description\": \"Find out more about Swagger\", \"url\": + \"http://swagger.io\"}}"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '17038' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi/importSpecification?api-version=2024-03-01 + response: + body: + string: '' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 11 Oct 2024 02:44:12 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: E91FEDFE2DC2485A916AE5B50DB9DEAE Ref B: MAA201060513019 Ref C: 2024-10-11T02:44:12Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api show + Connection: + - keep-alive + ParameterSetName: + - -g -n --api-id + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis","properties":{"title":"Swagger + Petstore","description":"This is a sample server Petstore server. You can + find out more about Swagger at [http://swagger.io](http://swagger.io) or on + [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you + can use the api key `special-key` to test the authorization filters.","kind":"rest","lifecycleStage":"design","license":{"name":"Apache + 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"externalDocumentation":[{"title":"Title","description":"Find + out more about Swagger","url":"http://swagger.io"}],"contacts":[{"email":"apiteam@swagger.io"}],"customProperties":{}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore","name":"swaggerpetstore","systemData":{"createdAt":"2024-10-11T02:44:06.2576704Z","lastModifiedAt":"2024-10-11T02:44:06.2576691Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '1002' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:15 GMT + etag: + - f100779e-0000-0100-0000-670890f90000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 9867111847E445208E3D2FA87FAF01C0 Ref B: MAA201060515019 Ref C: 2024-10-11T02:44:14Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version show + Connection: + - keep-alive + ParameterSetName: + - -g -n --api-id --version-id + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions","properties":{"title":"1-0-7","lifecycleStage":"design"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7","name":"1-0-7","systemData":{"createdAt":"2024-10-11T02:44:09.0438512Z","lastModifiedAt":"2024-10-11T02:44:09.0438503Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '436' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:17 GMT + etag: + - 9b00b547-0000-0100-0000-670890f90000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 4E9FA031535246C9A7019919D11E9E2D Ref B: MAA201060514027 Ref C: 2024-10-11T02:44:15Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition show + Connection: + - keep-alive + ParameterSetName: + - -g -n --api-id --version-id --definition-id + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions/definitions","properties":{"title":"openapi","description":"This + is a sample server Petstore server. You can find out more about Swagger at + [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For + this sample, you can use the api key `special-key` to test the authorization + filters.","specification":{"name":"openapi","version":"2-0"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi","name":"openapi","systemData":{"createdAt":"2024-10-11T02:44:11.5734667Z","lastModifiedAt":"2024-10-11T02:44:16.9447608Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '784' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:18 GMT + etag: + - 9f004032-0000-0100-0000-670891000000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 6906691EE0DF49E796E5F45D80D0530A Ref B: MAA201060513017 Ref C: 2024-10-11T02:44:17Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_register_with_yaml_spec_from_url.yaml b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_register_with_yaml_spec_from_url.yaml new file mode 100644 index 0000000000..f7236ea347 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_register_with_yaml_spec_from_url.yaml @@ -0,0 +1,926 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.3 + method: GET + uri: https://petstore.swagger.io/v2/swagger.yaml + response: + body: + string: "---\nswagger: \"2.0\"\ninfo:\n description: \"This is a sample server\ + \ Petstore server. You can find out more about\\\n \\ Swagger at [http://swagger.io](http://swagger.io)\ + \ or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\\\n \\ For\ + \ this sample, you can use the api key `special-key` to test the authorization\\\ + \n \\ filters.\"\n version: \"1.0.7\"\n title: \"Swagger Petstore\"\n\ + \ termsOfService: \"http://swagger.io/terms/\"\n contact:\n email: \"\ + apiteam@swagger.io\"\n license:\n name: \"Apache 2.0\"\n url: \"http://www.apache.org/licenses/LICENSE-2.0.html\"\ + \nhost: \"petstore.swagger.io\"\nbasePath: \"/v2\"\ntags:\n- name: \"pet\"\ + \n description: \"Everything about your Pets\"\n externalDocs:\n description:\ + \ \"Find out more\"\n url: \"http://swagger.io\"\n- name: \"store\"\n \ + \ description: \"Access to Petstore orders\"\n- name: \"user\"\n description:\ + \ \"Operations about user\"\n externalDocs:\n description: \"Find out\ + \ more about our store\"\n url: \"http://swagger.io\"\nschemes:\n- \"https\"\ + \n- \"http\"\npaths:\n /pet/{petId}/uploadImage:\n post:\n tags:\n\ + \ - \"pet\"\n summary: \"uploads an image\"\n description:\ + \ \"\"\n operationId: \"uploadFile\"\n consumes:\n - \"multipart/form-data\"\ + \n produces:\n - \"application/json\"\n parameters:\n \ + \ - name: \"petId\"\n in: \"path\"\n description: \"ID of pet\ + \ to update\"\n required: true\n type: \"integer\"\n \ + \ format: \"int64\"\n - name: \"additionalMetadata\"\n in: \"\ + formData\"\n description: \"Additional data to pass to server\"\n \ + \ required: false\n type: \"string\"\n - name: \"file\"\n\ + \ in: \"formData\"\n description: \"file to upload\"\n \ + \ required: false\n type: \"file\"\n responses:\n 200:\n\ + \ description: \"successful operation\"\n schema:\n \ + \ $ref: \"#/definitions/ApiResponse\"\n security:\n - petstore_auth:\n\ + \ - \"write:pets\"\n - \"read:pets\"\n /pet:\n post:\n \ + \ tags:\n - \"pet\"\n summary: \"Add a new pet to the store\"\ + \n description: \"\"\n operationId: \"addPet\"\n consumes:\n\ + \ - \"application/json\"\n - \"application/xml\"\n produces:\n\ + \ - \"application/json\"\n - \"application/xml\"\n parameters:\n\ + \ - in: \"body\"\n name: \"body\"\n description: \"Pet\ + \ object that needs to be added to the store\"\n required: true\n \ + \ schema:\n $ref: \"#/definitions/Pet\"\n responses:\n\ + \ 405:\n description: \"Invalid input\"\n security:\n\ + \ - petstore_auth:\n - \"write:pets\"\n - \"read:pets\"\ + \n put:\n tags:\n - \"pet\"\n summary: \"Update an existing\ + \ pet\"\n description: \"\"\n operationId: \"updatePet\"\n \ + \ consumes:\n - \"application/json\"\n - \"application/xml\"\n \ + \ produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - in: \"body\"\n name: \"body\"\n \ + \ description: \"Pet object that needs to be added to the store\"\n \ + \ required: true\n schema:\n $ref: \"#/definitions/Pet\"\ + \n responses:\n 400:\n description: \"Invalid ID supplied\"\ + \n 404:\n description: \"Pet not found\"\n 405:\n \ + \ description: \"Validation exception\"\n security:\n -\ + \ petstore_auth:\n - \"write:pets\"\n - \"read:pets\"\n /pet/findByStatus:\n\ + \ get:\n tags:\n - \"pet\"\n summary: \"Finds Pets by status\"\ + \n description: \"Multiple status values can be provided with comma separated\ + \ strings\"\n operationId: \"findPetsByStatus\"\n produces:\n \ + \ - \"application/json\"\n - \"application/xml\"\n parameters:\n\ + \ - name: \"status\"\n in: \"query\"\n description: \"\ + Status values that need to be considered for filter\"\n required: true\n\ + \ type: \"array\"\n items:\n type: \"string\"\n \ + \ enum:\n - \"available\"\n - \"pending\"\n \ + \ - \"sold\"\n default: \"available\"\n collectionFormat:\ + \ \"multi\"\n responses:\n 200:\n description: \"successful\ + \ operation\"\n schema:\n type: \"array\"\n \ + \ items:\n $ref: \"#/definitions/Pet\"\n 400:\n \ + \ description: \"Invalid status value\"\n security:\n - petstore_auth:\n\ + \ - \"write:pets\"\n - \"read:pets\"\n /pet/findByTags:\n \ + \ get:\n tags:\n - \"pet\"\n summary: \"Finds Pets by tags\"\ + \n description: \"Multiple tags can be provided with comma separated\ + \ strings. Use\\\n \\ tag1, tag2, tag3 for testing.\"\n operationId:\ + \ \"findPetsByTags\"\n produces:\n - \"application/json\"\n \ + \ - \"application/xml\"\n parameters:\n - name: \"tags\"\n \ + \ in: \"query\"\n description: \"Tags to filter by\"\n required:\ + \ true\n type: \"array\"\n items:\n type: \"string\"\ + \n collectionFormat: \"multi\"\n responses:\n 200:\n \ + \ description: \"successful operation\"\n schema:\n \ + \ type: \"array\"\n items:\n $ref: \"#/definitions/Pet\"\ + \n 400:\n description: \"Invalid tag value\"\n security:\n\ + \ - petstore_auth:\n - \"write:pets\"\n - \"read:pets\"\ + \n deprecated: true\n /pet/{petId}:\n get:\n tags:\n -\ + \ \"pet\"\n summary: \"Find pet by ID\"\n description: \"Returns\ + \ a single pet\"\n operationId: \"getPetById\"\n produces:\n \ + \ - \"application/json\"\n - \"application/xml\"\n parameters:\n\ + \ - name: \"petId\"\n in: \"path\"\n description: \"ID\ + \ of pet to return\"\n required: true\n type: \"integer\"\n\ + \ format: \"int64\"\n responses:\n 200:\n description:\ + \ \"successful operation\"\n schema:\n $ref: \"#/definitions/Pet\"\ + \n 400:\n description: \"Invalid ID supplied\"\n 404:\n\ + \ description: \"Pet not found\"\n security:\n - api_key:\ + \ []\n post:\n tags:\n - \"pet\"\n summary: \"Updates a\ + \ pet in the store with form data\"\n description: \"\"\n operationId:\ + \ \"updatePetWithForm\"\n consumes:\n - \"application/x-www-form-urlencoded\"\ + \n produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - name: \"petId\"\n in: \"path\"\n \ + \ description: \"ID of pet that needs to be updated\"\n required:\ + \ true\n type: \"integer\"\n format: \"int64\"\n - name:\ + \ \"name\"\n in: \"formData\"\n description: \"Updated name\ + \ of the pet\"\n required: false\n type: \"string\"\n -\ + \ name: \"status\"\n in: \"formData\"\n description: \"Updated\ + \ status of the pet\"\n required: false\n type: \"string\"\n\ + \ responses:\n 405:\n description: \"Invalid input\"\n\ + \ security:\n - petstore_auth:\n - \"write:pets\"\n \ + \ - \"read:pets\"\n delete:\n tags:\n - \"pet\"\n summary:\ + \ \"Deletes a pet\"\n description: \"\"\n operationId: \"deletePet\"\ + \n produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - name: \"api_key\"\n in: \"header\"\n \ + \ required: false\n type: \"string\"\n - name: \"petId\"\ + \n in: \"path\"\n description: \"Pet id to delete\"\n \ + \ required: true\n type: \"integer\"\n format: \"int64\"\n\ + \ responses:\n 400:\n description: \"Invalid ID supplied\"\ + \n 404:\n description: \"Pet not found\"\n security:\n\ + \ - petstore_auth:\n - \"write:pets\"\n - \"read:pets\"\ + \n /store/inventory:\n get:\n tags:\n - \"store\"\n summary:\ + \ \"Returns pet inventories by status\"\n description: \"Returns a map\ + \ of status codes to quantities\"\n operationId: \"getInventory\"\n \ + \ produces:\n - \"application/json\"\n parameters: []\n \ + \ responses:\n 200:\n description: \"successful operation\"\ + \n schema:\n type: \"object\"\n additionalProperties:\n\ + \ type: \"integer\"\n format: \"int32\"\n security:\n\ + \ - api_key: []\n /store/order:\n post:\n tags:\n - \"\ + store\"\n summary: \"Place an order for a pet\"\n description: \"\ + \"\n operationId: \"placeOrder\"\n consumes:\n - \"application/json\"\ + \n produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - in: \"body\"\n name: \"body\"\n \ + \ description: \"order placed for purchasing the pet\"\n required:\ + \ true\n schema:\n $ref: \"#/definitions/Order\"\n responses:\n\ + \ 200:\n description: \"successful operation\"\n \ + \ schema:\n $ref: \"#/definitions/Order\"\n 400:\n \ + \ description: \"Invalid Order\"\n /store/order/{orderId}:\n get:\n\ + \ tags:\n - \"store\"\n summary: \"Find purchase order by ID\"\ + \n description: \"For valid response try integer IDs with value >= 1\ + \ and <= 10.\\\n \\ Other values will generated exceptions\"\n \ + \ operationId: \"getOrderById\"\n produces:\n - \"application/json\"\ + \n - \"application/xml\"\n parameters:\n - name: \"orderId\"\ + \n in: \"path\"\n description: \"ID of pet that needs to be\ + \ fetched\"\n required: true\n type: \"integer\"\n maximum:\ + \ 10\n minimum: 1\n format: \"int64\"\n responses:\n \ + \ 200:\n description: \"successful operation\"\n schema:\n\ + \ $ref: \"#/definitions/Order\"\n 400:\n description:\ + \ \"Invalid ID supplied\"\n 404:\n description: \"Order not\ + \ found\"\n delete:\n tags:\n - \"store\"\n summary: \"\ + Delete purchase order by ID\"\n description: \"For valid response try\ + \ integer IDs with positive integer value.\\\n \\ Negative or non-integer\ + \ values will generate API errors\"\n operationId: \"deleteOrder\"\n\ + \ produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - name: \"orderId\"\n in: \"path\"\n \ + \ description: \"ID of the order that needs to be deleted\"\n required:\ + \ true\n type: \"integer\"\n minimum: 1\n format: \"\ + int64\"\n responses:\n 400:\n description: \"Invalid\ + \ ID supplied\"\n 404:\n description: \"Order not found\"\n\ + \ /user/createWithList:\n post:\n tags:\n - \"user\"\n \ + \ summary: \"Creates list of users with given input array\"\n description:\ + \ \"\"\n operationId: \"createUsersWithListInput\"\n consumes:\n\ + \ - \"application/json\"\n produces:\n - \"application/json\"\ + \n - \"application/xml\"\n parameters:\n - in: \"body\"\n \ + \ name: \"body\"\n description: \"List of user object\"\n \ + \ required: true\n schema:\n type: \"array\"\n \ + \ items:\n $ref: \"#/definitions/User\"\n responses:\n \ + \ default:\n description: \"successful operation\"\n /user/{username}:\n\ + \ get:\n tags:\n - \"user\"\n summary: \"Get user by user\ + \ name\"\n description: \"\"\n operationId: \"getUserByName\"\n\ + \ produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - name: \"username\"\n in: \"path\"\n \ + \ description: \"The name that needs to be fetched. Use user1 for testing.\ + \ \"\n required: true\n type: \"string\"\n responses:\n\ + \ 200:\n description: \"successful operation\"\n \ + \ schema:\n $ref: \"#/definitions/User\"\n 400:\n \ + \ description: \"Invalid username supplied\"\n 404:\n description:\ + \ \"User not found\"\n put:\n tags:\n - \"user\"\n summary:\ + \ \"Updated user\"\n description: \"This can only be done by the logged\ + \ in user.\"\n operationId: \"updateUser\"\n consumes:\n -\ + \ \"application/json\"\n produces:\n - \"application/json\"\n \ + \ - \"application/xml\"\n parameters:\n - name: \"username\"\n\ + \ in: \"path\"\n description: \"name that need to be updated\"\ + \n required: true\n type: \"string\"\n - in: \"body\"\n\ + \ name: \"body\"\n description: \"Updated user object\"\n \ + \ required: true\n schema:\n $ref: \"#/definitions/User\"\ + \n responses:\n 400:\n description: \"Invalid user supplied\"\ + \n 404:\n description: \"User not found\"\n delete:\n \ + \ tags:\n - \"user\"\n summary: \"Delete user\"\n description:\ + \ \"This can only be done by the logged in user.\"\n operationId: \"\ + deleteUser\"\n produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - name: \"username\"\n in: \"path\"\n \ + \ description: \"The name that needs to be deleted\"\n required:\ + \ true\n type: \"string\"\n responses:\n 400:\n \ + \ description: \"Invalid username supplied\"\n 404:\n description:\ + \ \"User not found\"\n /user/login:\n get:\n tags:\n - \"user\"\ + \n summary: \"Logs user into the system\"\n description: \"\"\n\ + \ operationId: \"loginUser\"\n produces:\n - \"application/json\"\ + \n - \"application/xml\"\n parameters:\n - name: \"username\"\ + \n in: \"query\"\n description: \"The user name for login\"\n\ + \ required: true\n type: \"string\"\n - name: \"password\"\ + \n in: \"query\"\n description: \"The password for login in\ + \ clear text\"\n required: true\n type: \"string\"\n responses:\n\ + \ 200:\n description: \"successful operation\"\n \ + \ headers:\n X-Expires-After:\n type: \"string\"\n\ + \ format: \"date-time\"\n description: \"date in\ + \ UTC when token expires\"\n X-Rate-Limit:\n type:\ + \ \"integer\"\n format: \"int32\"\n description:\ + \ \"calls per hour allowed by the user\"\n schema:\n type:\ + \ \"string\"\n 400:\n description: \"Invalid username/password\ + \ supplied\"\n /user/logout:\n get:\n tags:\n - \"user\"\n \ + \ summary: \"Logs out current logged in user session\"\n description:\ + \ \"\"\n operationId: \"logoutUser\"\n produces:\n - \"application/json\"\ + \n - \"application/xml\"\n parameters: []\n responses:\n \ + \ default:\n description: \"successful operation\"\n /user/createWithArray:\n\ + \ post:\n tags:\n - \"user\"\n summary: \"Creates list of\ + \ users with given input array\"\n description: \"\"\n operationId:\ + \ \"createUsersWithArrayInput\"\n consumes:\n - \"application/json\"\ + \n produces:\n - \"application/json\"\n - \"application/xml\"\ + \n parameters:\n - in: \"body\"\n name: \"body\"\n \ + \ description: \"List of user object\"\n required: true\n schema:\n\ + \ type: \"array\"\n items:\n $ref: \"#/definitions/User\"\ + \n responses:\n default:\n description: \"successful\ + \ operation\"\n /user:\n post:\n tags:\n - \"user\"\n summary:\ + \ \"Create user\"\n description: \"This can only be done by the logged\ + \ in user.\"\n operationId: \"createUser\"\n consumes:\n -\ + \ \"application/json\"\n produces:\n - \"application/json\"\n \ + \ - \"application/xml\"\n parameters:\n - in: \"body\"\n \ + \ name: \"body\"\n description: \"Created user object\"\n \ + \ required: true\n schema:\n $ref: \"#/definitions/User\"\ + \n responses:\n default:\n description: \"successful\ + \ operation\"\nsecurityDefinitions:\n api_key:\n type: \"apiKey\"\n \ + \ name: \"api_key\"\n in: \"header\"\n petstore_auth:\n type: \"oauth2\"\ + \n authorizationUrl: \"https://petstore.swagger.io/oauth/authorize\"\n\ + \ flow: \"implicit\"\n scopes:\n read:pets: \"read your pets\"\n\ + \ write:pets: \"modify pets in your account\"\ndefinitions:\n ApiResponse:\n\ + \ type: \"object\"\n properties:\n code:\n type: \"integer\"\ + \n format: \"int32\"\n type:\n type: \"string\"\n \ + \ message:\n type: \"string\"\n Category:\n type: \"object\"\n\ + \ properties:\n id:\n type: \"integer\"\n format: \"\ + int64\"\n name:\n type: \"string\"\n xml:\n name: \"Category\"\ + \n Pet:\n type: \"object\"\n required:\n - \"name\"\n - \"photoUrls\"\ + \n properties:\n id:\n type: \"integer\"\n format: \"\ + int64\"\n category:\n $ref: \"#/definitions/Category\"\n \ + \ name:\n type: \"string\"\n example: \"doggie\"\n photoUrls:\n\ + \ type: \"array\"\n xml:\n wrapped: true\n items:\n\ + \ type: \"string\"\n xml:\n name: \"photoUrl\"\ + \n tags:\n type: \"array\"\n xml:\n wrapped: true\n\ + \ items:\n xml:\n name: \"tag\"\n $ref:\ + \ \"#/definitions/Tag\"\n status:\n type: \"string\"\n \ + \ description: \"pet status in the store\"\n enum:\n - \"available\"\ + \n - \"pending\"\n - \"sold\"\n xml:\n name: \"Pet\"\ + \n Tag:\n type: \"object\"\n properties:\n id:\n type:\ + \ \"integer\"\n format: \"int64\"\n name:\n type: \"string\"\ + \n xml:\n name: \"Tag\"\n Order:\n type: \"object\"\n properties:\n\ + \ id:\n type: \"integer\"\n format: \"int64\"\n petId:\n\ + \ type: \"integer\"\n format: \"int64\"\n quantity:\n \ + \ type: \"integer\"\n format: \"int32\"\n shipDate:\n \ + \ type: \"string\"\n format: \"date-time\"\n status:\n \ + \ type: \"string\"\n description: \"Order Status\"\n enum:\n\ + \ - \"placed\"\n - \"approved\"\n - \"delivered\"\n \ + \ complete:\n type: \"boolean\"\n xml:\n name: \"Order\"\ + \n User:\n type: \"object\"\n properties:\n id:\n type:\ + \ \"integer\"\n format: \"int64\"\n username:\n type: \"\ + string\"\n firstName:\n type: \"string\"\n lastName:\n \ + \ type: \"string\"\n email:\n type: \"string\"\n password:\n\ + \ type: \"string\"\n phone:\n type: \"string\"\n userStatus:\n\ + \ type: \"integer\"\n format: \"int32\"\n description:\ + \ \"User Status\"\n xml:\n name: \"User\"\nexternalDocs:\n description:\ + \ \"Find out more about Swagger\"\n url: \"http://swagger.io\"\n" + headers: + access-control-allow-headers: + - Content-Type, api_key, Authorization + access-control-allow-methods: + - GET, POST, DELETE, PUT + access-control-allow-origin: + - '*' + connection: + - keep-alive + content-type: + - application/yaml + date: + - Fri, 11 Oct 2024 02:44:03 GMT + server: + - Jetty(9.2.9.v20150224) + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: '{"properties": {"contacts": [{"email": "apiteam@swagger.io"}], "description": + "This is a sample server Petstore server. You can find out more about Swagger + at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For + this sample, you can use the api key `special-key` to test the authorization + filters.", "externalDocumentation": [{"description": "Find out more about Swagger", + "title": "Title", "url": "http://swagger.io"}], "kind": "rest", "license": {"name": + "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html"}, "title": + "Swagger Petstore"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '611' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis","properties":{"title":"Swagger + Petstore","description":"This is a sample server Petstore server. You can + find out more about Swagger at [http://swagger.io](http://swagger.io) or on + [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you + can use the api key `special-key` to test the authorization filters.","kind":"rest","license":{"name":"Apache + 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"externalDocumentation":[{"title":"Title","description":"Find + out more about Swagger","url":"http://swagger.io"}],"contacts":[{"email":"apiteam@swagger.io"}],"customProperties":{}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore","name":"swaggerpetstore","systemData":{"createdAt":"2024-10-11T02:44:06.0280787Z","lastModifiedAt":"2024-10-11T02:44:06.0280775Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '976' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:05 GMT + etag: + - f100279e-0000-0100-0000-670890f60000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: E7EE183433B34DC69D0CEBBE037CFBF4 Ref B: MAA201060514029 Ref C: 2024-10-11T02:44:04Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"lifecycleStage": "design", "title": "1-0-7"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '62' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions","properties":{"title":"1-0-7","lifecycleStage":"design"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7","name":"1-0-7","systemData":{"createdAt":"2024-10-11T02:44:08.4841605Z","lastModifiedAt":"2024-10-11T02:44:08.4841597Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '436' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:08 GMT + etag: + - 9b00a947-0000-0100-0000-670890f80000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: 80ACEE3F12C045FDA57788ABD9C16A31 Ref B: MAA201060514011 Ref C: 2024-10-11T02:44:06Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "This is a sample server Petstore server. You + can find out more about Swagger at [http://swagger.io](http://swagger.io) or + on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you + can use the api key `special-key` to test the authorization filters.", "title": + "openapi"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '325' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions/definitions","properties":{"title":"openapi","description":"This + is a sample server Petstore server. You can find out more about Swagger at + [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For + this sample, you can use the api key `special-key` to test the authorization + filters."},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi","name":"openapi","systemData":{"createdAt":"2024-10-11T02:44:11.096952Z","lastModifiedAt":"2024-10-11T02:44:11.0969509Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '732' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:11 GMT + etag: + - 9f00a231-0000-0100-0000-670890fb0000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: 84D06244C8954340AFE16FEF4FF29EFF Ref B: MAA201060513037 Ref C: 2024-10-11T02:44:09Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"format": "inline", "specification": {"name": "openapi", "version": "2-0"}, + "value": "{\"swagger\": \"2.0\", \"info\": {\"description\": \"This is a sample + server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) + or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, + you can use the api key `special-key` to test the authorization filters.\", + \"version\": \"1.0.7\", \"title\": \"Swagger Petstore\", \"termsOfService\": + \"http://swagger.io/terms/\", \"contact\": {\"email\": \"apiteam@swagger.io\"}, + \"license\": {\"name\": \"Apache 2.0\", \"url\": \"http://www.apache.org/licenses/LICENSE-2.0.html\"}}, + \"host\": \"petstore.swagger.io\", \"basePath\": \"/v2\", \"tags\": [{\"name\": + \"pet\", \"description\": \"Everything about your Pets\", \"externalDocs\": + {\"description\": \"Find out more\", \"url\": \"http://swagger.io\"}}, {\"name\": + \"store\", \"description\": \"Access to Petstore orders\"}, {\"name\": \"user\", + \"description\": \"Operations about user\", \"externalDocs\": {\"description\": + \"Find out more about our store\", \"url\": \"http://swagger.io\"}}], \"schemes\": + [\"https\", \"http\"], \"paths\": {\"/pet/{petId}/uploadImage\": {\"post\": + {\"tags\": [\"pet\"], \"summary\": \"uploads an image\", \"description\": \"\", + \"operationId\": \"uploadFile\", \"consumes\": [\"multipart/form-data\"], \"produces\": + [\"application/json\"], \"parameters\": [{\"name\": \"petId\", \"in\": \"path\", + \"description\": \"ID of pet to update\", \"required\": true, \"type\": \"integer\", + \"format\": \"int64\"}, {\"name\": \"additionalMetadata\", \"in\": \"formData\", + \"description\": \"Additional data to pass to server\", \"required\": false, + \"type\": \"string\"}, {\"name\": \"file\", \"in\": \"formData\", \"description\": + \"file to upload\", \"required\": false, \"type\": \"file\"}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"$ref\": + \"#/definitions/ApiResponse\"}}}, \"security\": [{\"petstore_auth\": [\"write:pets\", + \"read:pets\"]}]}}, \"/pet\": {\"post\": {\"tags\": [\"pet\"], \"summary\": + \"Add a new pet to the store\", \"description\": \"\", \"operationId\": \"addPet\", + \"consumes\": [\"application/json\", \"application/xml\"], \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"in\": \"body\", \"name\": \"body\", + \"description\": \"Pet object that needs to be added to the store\", \"required\": + true, \"schema\": {\"$ref\": \"#/definitions/Pet\"}}], \"responses\": {\"405\": + {\"description\": \"Invalid input\"}}, \"security\": [{\"petstore_auth\": [\"write:pets\", + \"read:pets\"]}]}, \"put\": {\"tags\": [\"pet\"], \"summary\": \"Update an existing + pet\", \"description\": \"\", \"operationId\": \"updatePet\", \"consumes\": + [\"application/json\", \"application/xml\"], \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"in\": \"body\", \"name\": \"body\", + \"description\": \"Pet object that needs to be added to the store\", \"required\": + true, \"schema\": {\"$ref\": \"#/definitions/Pet\"}}], \"responses\": {\"400\": + {\"description\": \"Invalid ID supplied\"}, \"404\": {\"description\": \"Pet + not found\"}, \"405\": {\"description\": \"Validation exception\"}}, \"security\": + [{\"petstore_auth\": [\"write:pets\", \"read:pets\"]}]}}, \"/pet/findByStatus\": + {\"get\": {\"tags\": [\"pet\"], \"summary\": \"Finds Pets by status\", \"description\": + \"Multiple status values can be provided with comma separated strings\", \"operationId\": + \"findPetsByStatus\", \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"name\": \"status\", \"in\": \"query\", \"description\": + \"Status values that need to be considered for filter\", \"required\": true, + \"type\": \"array\", \"items\": {\"type\": \"string\", \"enum\": [\"available\", + \"pending\", \"sold\"], \"default\": \"available\"}, \"collectionFormat\": \"multi\"}], + \"responses\": {\"200\": {\"description\": \"successful operation\", \"schema\": + {\"type\": \"array\", \"items\": {\"$ref\": \"#/definitions/Pet\"}}}, \"400\": + {\"description\": \"Invalid status value\"}}, \"security\": [{\"petstore_auth\": + [\"write:pets\", \"read:pets\"]}]}}, \"/pet/findByTags\": {\"get\": {\"tags\": + [\"pet\"], \"summary\": \"Finds Pets by tags\", \"description\": \"Multiple + tags can be provided with comma separated strings. Use tag1, tag2, tag3 for + testing.\", \"operationId\": \"findPetsByTags\", \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"name\": \"tags\", \"in\": \"query\", + \"description\": \"Tags to filter by\", \"required\": true, \"type\": \"array\", + \"items\": {\"type\": \"string\"}, \"collectionFormat\": \"multi\"}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"type\": + \"array\", \"items\": {\"$ref\": \"#/definitions/Pet\"}}}, \"400\": {\"description\": + \"Invalid tag value\"}}, \"security\": [{\"petstore_auth\": [\"write:pets\", + \"read:pets\"]}], \"deprecated\": true}}, \"/pet/{petId}\": {\"get\": {\"tags\": + [\"pet\"], \"summary\": \"Find pet by ID\", \"description\": \"Returns a single + pet\", \"operationId\": \"getPetById\", \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"name\": \"petId\", \"in\": \"path\", + \"description\": \"ID of pet to return\", \"required\": true, \"type\": \"integer\", + \"format\": \"int64\"}], \"responses\": {\"200\": {\"description\": \"successful + operation\", \"schema\": {\"$ref\": \"#/definitions/Pet\"}}, \"400\": {\"description\": + \"Invalid ID supplied\"}, \"404\": {\"description\": \"Pet not found\"}}, \"security\": + [{\"api_key\": []}]}, \"post\": {\"tags\": [\"pet\"], \"summary\": \"Updates + a pet in the store with form data\", \"description\": \"\", \"operationId\": + \"updatePetWithForm\", \"consumes\": [\"application/x-www-form-urlencoded\"], + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"petId\", \"in\": \"path\", \"description\": \"ID of pet that needs to be updated\", + \"required\": true, \"type\": \"integer\", \"format\": \"int64\"}, {\"name\": + \"name\", \"in\": \"formData\", \"description\": \"Updated name of the pet\", + \"required\": false, \"type\": \"string\"}, {\"name\": \"status\", \"in\": \"formData\", + \"description\": \"Updated status of the pet\", \"required\": false, \"type\": + \"string\"}], \"responses\": {\"405\": {\"description\": \"Invalid input\"}}, + \"security\": [{\"petstore_auth\": [\"write:pets\", \"read:pets\"]}]}, \"delete\": + {\"tags\": [\"pet\"], \"summary\": \"Deletes a pet\", \"description\": \"\", + \"operationId\": \"deletePet\", \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"name\": \"api_key\", \"in\": \"header\", \"required\": false, + \"type\": \"string\"}, {\"name\": \"petId\", \"in\": \"path\", \"description\": + \"Pet id to delete\", \"required\": true, \"type\": \"integer\", \"format\": + \"int64\"}], \"responses\": {\"400\": {\"description\": \"Invalid ID supplied\"}, + \"404\": {\"description\": \"Pet not found\"}}, \"security\": [{\"petstore_auth\": + [\"write:pets\", \"read:pets\"]}]}}, \"/store/inventory\": {\"get\": {\"tags\": + [\"store\"], \"summary\": \"Returns pet inventories by status\", \"description\": + \"Returns a map of status codes to quantities\", \"operationId\": \"getInventory\", + \"produces\": [\"application/json\"], \"parameters\": [], \"responses\": {\"200\": + {\"description\": \"successful operation\", \"schema\": {\"type\": \"object\", + \"additionalProperties\": {\"type\": \"integer\", \"format\": \"int32\"}}}}, + \"security\": [{\"api_key\": []}]}}, \"/store/order\": {\"post\": {\"tags\": + [\"store\"], \"summary\": \"Place an order for a pet\", \"description\": \"\", + \"operationId\": \"placeOrder\", \"consumes\": [\"application/json\"], \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [{\"in\": \"body\", + \"name\": \"body\", \"description\": \"order placed for purchasing the pet\", + \"required\": true, \"schema\": {\"$ref\": \"#/definitions/Order\"}}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"$ref\": + \"#/definitions/Order\"}}, \"400\": {\"description\": \"Invalid Order\"}}}}, + \"/store/order/{orderId}\": {\"get\": {\"tags\": [\"store\"], \"summary\": \"Find + purchase order by ID\", \"description\": \"For valid response try integer IDs + with value >= 1 and <= 10. Other values will generated exceptions\", \"operationId\": + \"getOrderById\", \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"name\": \"orderId\", \"in\": \"path\", \"description\": + \"ID of pet that needs to be fetched\", \"required\": true, \"type\": \"integer\", + \"maximum\": 10, \"minimum\": 1, \"format\": \"int64\"}], \"responses\": {\"200\": + {\"description\": \"successful operation\", \"schema\": {\"$ref\": \"#/definitions/Order\"}}, + \"400\": {\"description\": \"Invalid ID supplied\"}, \"404\": {\"description\": + \"Order not found\"}}}, \"delete\": {\"tags\": [\"store\"], \"summary\": \"Delete + purchase order by ID\", \"description\": \"For valid response try integer IDs + with positive integer value. Negative or non-integer values will generate API + errors\", \"operationId\": \"deleteOrder\", \"produces\": [\"application/json\", + \"application/xml\"], \"parameters\": [{\"name\": \"orderId\", \"in\": \"path\", + \"description\": \"ID of the order that needs to be deleted\", \"required\": + true, \"type\": \"integer\", \"minimum\": 1, \"format\": \"int64\"}], \"responses\": + {\"400\": {\"description\": \"Invalid ID supplied\"}, \"404\": {\"description\": + \"Order not found\"}}}}, \"/user/createWithList\": {\"post\": {\"tags\": [\"user\"], + \"summary\": \"Creates list of users with given input array\", \"description\": + \"\", \"operationId\": \"createUsersWithListInput\", \"consumes\": [\"application/json\"], + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"in\": + \"body\", \"name\": \"body\", \"description\": \"List of user object\", \"required\": + true, \"schema\": {\"type\": \"array\", \"items\": {\"$ref\": \"#/definitions/User\"}}}], + \"responses\": {\"default\": {\"description\": \"successful operation\"}}}}, + \"/user/{username}\": {\"get\": {\"tags\": [\"user\"], \"summary\": \"Get user + by user name\", \"description\": \"\", \"operationId\": \"getUserByName\", \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": \"username\", + \"in\": \"path\", \"description\": \"The name that needs to be fetched. Use + user1 for testing. \", \"required\": true, \"type\": \"string\"}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"schema\": {\"$ref\": + \"#/definitions/User\"}}, \"400\": {\"description\": \"Invalid username supplied\"}, + \"404\": {\"description\": \"User not found\"}}}, \"put\": {\"tags\": [\"user\"], + \"summary\": \"Updated user\", \"description\": \"This can only be done by the + logged in user.\", \"operationId\": \"updateUser\", \"consumes\": [\"application/json\"], + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"username\", \"in\": \"path\", \"description\": \"name that need to be updated\", + \"required\": true, \"type\": \"string\"}, {\"in\": \"body\", \"name\": \"body\", + \"description\": \"Updated user object\", \"required\": true, \"schema\": {\"$ref\": + \"#/definitions/User\"}}], \"responses\": {\"400\": {\"description\": \"Invalid + user supplied\"}, \"404\": {\"description\": \"User not found\"}}}, \"delete\": + {\"tags\": [\"user\"], \"summary\": \"Delete user\", \"description\": \"This + can only be done by the logged in user.\", \"operationId\": \"deleteUser\", + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"username\", \"in\": \"path\", \"description\": \"The name that needs to be + deleted\", \"required\": true, \"type\": \"string\"}], \"responses\": {\"400\": + {\"description\": \"Invalid username supplied\"}, \"404\": {\"description\": + \"User not found\"}}}}, \"/user/login\": {\"get\": {\"tags\": [\"user\"], \"summary\": + \"Logs user into the system\", \"description\": \"\", \"operationId\": \"loginUser\", + \"produces\": [\"application/json\", \"application/xml\"], \"parameters\": [{\"name\": + \"username\", \"in\": \"query\", \"description\": \"The user name for login\", + \"required\": true, \"type\": \"string\"}, {\"name\": \"password\", \"in\": + \"query\", \"description\": \"The password for login in clear text\", \"required\": + true, \"type\": \"string\"}], \"responses\": {\"200\": {\"description\": \"successful + operation\", \"headers\": {\"X-Expires-After\": {\"type\": \"string\", \"format\": + \"date-time\", \"description\": \"date in UTC when token expires\"}, \"X-Rate-Limit\": + {\"type\": \"integer\", \"format\": \"int32\", \"description\": \"calls per + hour allowed by the user\"}}, \"schema\": {\"type\": \"string\"}}, \"400\": + {\"description\": \"Invalid username/password supplied\"}}}}, \"/user/logout\": + {\"get\": {\"tags\": [\"user\"], \"summary\": \"Logs out current logged in user + session\", \"description\": \"\", \"operationId\": \"logoutUser\", \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [], \"responses\": + {\"default\": {\"description\": \"successful operation\"}}}}, \"/user/createWithArray\": + {\"post\": {\"tags\": [\"user\"], \"summary\": \"Creates list of users with + given input array\", \"description\": \"\", \"operationId\": \"createUsersWithArrayInput\", + \"consumes\": [\"application/json\"], \"produces\": [\"application/json\", \"application/xml\"], + \"parameters\": [{\"in\": \"body\", \"name\": \"body\", \"description\": \"List + of user object\", \"required\": true, \"schema\": {\"type\": \"array\", \"items\": + {\"$ref\": \"#/definitions/User\"}}}], \"responses\": {\"default\": {\"description\": + \"successful operation\"}}}}, \"/user\": {\"post\": {\"tags\": [\"user\"], \"summary\": + \"Create user\", \"description\": \"This can only be done by the logged in user.\", + \"operationId\": \"createUser\", \"consumes\": [\"application/json\"], \"produces\": + [\"application/json\", \"application/xml\"], \"parameters\": [{\"in\": \"body\", + \"name\": \"body\", \"description\": \"Created user object\", \"required\": + true, \"schema\": {\"$ref\": \"#/definitions/User\"}}], \"responses\": {\"default\": + {\"description\": \"successful operation\"}}}}}, \"securityDefinitions\": {\"api_key\": + {\"type\": \"apiKey\", \"name\": \"api_key\", \"in\": \"header\"}, \"petstore_auth\": + {\"type\": \"oauth2\", \"authorizationUrl\": \"https://petstore.swagger.io/oauth/authorize\", + \"flow\": \"implicit\", \"scopes\": {\"read:pets\": \"read your pets\", \"write:pets\": + \"modify pets in your account\"}}}, \"definitions\": {\"ApiResponse\": {\"type\": + \"object\", \"properties\": {\"code\": {\"type\": \"integer\", \"format\": \"int32\"}, + \"type\": {\"type\": \"string\"}, \"message\": {\"type\": \"string\"}}}, \"Category\": + {\"type\": \"object\", \"properties\": {\"id\": {\"type\": \"integer\", \"format\": + \"int64\"}, \"name\": {\"type\": \"string\"}}, \"xml\": {\"name\": \"Category\"}}, + \"Pet\": {\"type\": \"object\", \"required\": [\"name\", \"photoUrls\"], \"properties\": + {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"category\": {\"$ref\": + \"#/definitions/Category\"}, \"name\": {\"type\": \"string\", \"example\": \"doggie\"}, + \"photoUrls\": {\"type\": \"array\", \"xml\": {\"wrapped\": true}, \"items\": + {\"type\": \"string\", \"xml\": {\"name\": \"photoUrl\"}}}, \"tags\": {\"type\": + \"array\", \"xml\": {\"wrapped\": true}, \"items\": {\"xml\": {\"name\": \"tag\"}, + \"$ref\": \"#/definitions/Tag\"}}, \"status\": {\"type\": \"string\", \"description\": + \"pet status in the store\", \"enum\": [\"available\", \"pending\", \"sold\"]}}, + \"xml\": {\"name\": \"Pet\"}}, \"Tag\": {\"type\": \"object\", \"properties\": + {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"name\": {\"type\": + \"string\"}}, \"xml\": {\"name\": \"Tag\"}}, \"Order\": {\"type\": \"object\", + \"properties\": {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"petId\": + {\"type\": \"integer\", \"format\": \"int64\"}, \"quantity\": {\"type\": \"integer\", + \"format\": \"int32\"}, \"shipDate\": {\"type\": \"string\", \"format\": \"date-time\"}, + \"status\": {\"type\": \"string\", \"description\": \"Order Status\", \"enum\": + [\"placed\", \"approved\", \"delivered\"]}, \"complete\": {\"type\": \"boolean\"}}, + \"xml\": {\"name\": \"Order\"}}, \"User\": {\"type\": \"object\", \"properties\": + {\"id\": {\"type\": \"integer\", \"format\": \"int64\"}, \"username\": {\"type\": + \"string\"}, \"firstName\": {\"type\": \"string\"}, \"lastName\": {\"type\": + \"string\"}, \"email\": {\"type\": \"string\"}, \"password\": {\"type\": \"string\"}, + \"phone\": {\"type\": \"string\"}, \"userStatus\": {\"type\": \"integer\", \"format\": + \"int32\", \"description\": \"User Status\"}}, \"xml\": {\"name\": \"User\"}}}, + \"externalDocs\": {\"description\": \"Find out more about Swagger\", \"url\": + \"http://swagger.io\"}}"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '17038' + Content-Type: + - application/json + ParameterSetName: + - -g -n -l + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi/importSpecification?api-version=2024-03-01 + response: + body: + string: '' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 11 Oct 2024 02:44:13 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: CE8121949AD141AC9C7F1A23E721C49E Ref B: MAA201060514049 Ref C: 2024-10-11T02:44:11Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api show + Connection: + - keep-alive + ParameterSetName: + - -g -n --api-id + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis","properties":{"title":"Swagger + Petstore","description":"This is a sample server Petstore server. You can + find out more about Swagger at [http://swagger.io](http://swagger.io) or on + [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you + can use the api key `special-key` to test the authorization filters.","kind":"rest","lifecycleStage":"design","license":{"name":"Apache + 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"externalDocumentation":[{"title":"Title","description":"Find + out more about Swagger","url":"http://swagger.io"}],"contacts":[{"email":"apiteam@swagger.io"}],"customProperties":{}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore","name":"swaggerpetstore","systemData":{"createdAt":"2024-10-11T02:44:06.0280787Z","lastModifiedAt":"2024-10-11T02:44:06.0280775Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '1002' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:14 GMT + etag: + - f100669e-0000-0100-0000-670890f80000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: E27647E0E7E84FEE968BF6CB0A185101 Ref B: MAA201060515039 Ref C: 2024-10-11T02:44:14Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version show + Connection: + - keep-alive + ParameterSetName: + - -g -n --api-id --version-id + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions","properties":{"title":"1-0-7","lifecycleStage":"design"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7","name":"1-0-7","systemData":{"createdAt":"2024-10-11T02:44:08.4841605Z","lastModifiedAt":"2024-10-11T02:44:08.4841597Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '436' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:16 GMT + etag: + - 9b00a947-0000-0100-0000-670890f80000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: D7F2DC662C6F42FAA2149D147BE155B4 Ref B: MAA201060515047 Ref C: 2024-10-11T02:44:15Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition show + Connection: + - keep-alive + ParameterSetName: + - -g -n --api-id --version-id --definition-id + User-Agent: + - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions/definitions","properties":{"title":"openapi","description":"This + is a sample server Petstore server. You can find out more about Swagger at + [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For + this sample, you can use the api key `special-key` to test the authorization + filters.","specification":{"name":"openapi","version":"2-0"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore/versions/1-0-7/definitions/openapi","name":"openapi","systemData":{"createdAt":"2024-10-11T02:44:11.096952Z","lastModifiedAt":"2024-10-11T02:44:13.4123369Z"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview + cache-control: + - no-cache + content-length: + - '783' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 11 Oct 2024 02:44:18 GMT + etag: + - 9f00ee31-0000-0100-0000-670890fd0000 + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 198C249746A447B4A9F429B05230AB38 Ref B: MAA201060514031 Ref C: 2024-10-11T02:44:17Z' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/apic-extension/azext_apic_extension/tests/latest/test_register_command.py b/src/apic-extension/azext_apic_extension/tests/latest/test_register_command.py index 2f7640a87a..021d99d7c8 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/test_register_command.py +++ b/src/apic-extension/azext_apic_extension/tests/latest/test_register_command.py @@ -116,6 +116,78 @@ def test_register_with_json_spec(self): finally: os.remove(exported_file_path) + @ResourceGroupPreparer(name_prefix="clirg", location=TEST_REGION, random_name_length=32) + @ApicServicePreparer() + def test_register_with_json_spec_from_url(self): + self.kwargs.update({ + 'spec_url': 'https://petstore.swagger.io/v2/swagger.json' + }) + self.cmd('az apic api register -g {rg} -n {s} -l "{spec_url}"') + + # verify command results + self.cmd('az apic api show -g {rg} -n {s} --api-id swaggerpetstore', checks=[ + self.check('contacts[0].email', 'apiteam@swagger.io'), + self.check('description', 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'), + self.check('kind', 'rest'), + self.check('license.name', 'Apache 2.0'), + self.check('license.url', 'http://www.apache.org/licenses/LICENSE-2.0.html'), + self.check('lifecycleStage', 'design'), + self.check('name', 'swaggerpetstore'), + self.check('summary', None), + self.check('title', 'Swagger Petstore'), + self.check('externalDocumentation', [{'description': 'Find out more about Swagger', 'title': 'Title', 'url': 'http://swagger.io'}]) + ]) + + self.cmd('az apic api version show -g {rg} -n {s} --api-id swaggerpetstore --version-id 1-0-7', checks=[ + self.check('lifecycleStage', 'design'), + self.check('name', '1-0-7'), + self.check('title', '1-0-7'), + ]) + + self.cmd('az apic api definition show -g {rg} -n {s} --api-id swaggerpetstore --version-id 1-0-7 --definition-id openapi', checks=[ + self.check('description', 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'), + self.check('name', 'openapi'), + self.check('specification.name', 'openapi'), + self.check('specification.version', '2-0'), + self.check('title', 'openapi'), + ]) + + @ResourceGroupPreparer(name_prefix="clirg", location=TEST_REGION, random_name_length=32) + @ApicServicePreparer() + def test_register_with_yaml_spec_from_url(self): + self.kwargs.update({ + 'spec_url': 'https://petstore.swagger.io/v2/swagger.yaml' + }) + self.cmd('az apic api register -g {rg} -n {s} -l "{spec_url}"') + + # verify command results + self.cmd('az apic api show -g {rg} -n {s} --api-id swaggerpetstore', checks=[ + self.check('contacts[0].email', 'apiteam@swagger.io'), + self.check('description', 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'), + self.check('kind', 'rest'), + self.check('license.name', 'Apache 2.0'), + self.check('license.url', 'http://www.apache.org/licenses/LICENSE-2.0.html'), + self.check('lifecycleStage', 'design'), + self.check('name', 'swaggerpetstore'), + self.check('summary', None), + self.check('title', 'Swagger Petstore'), + self.check('externalDocumentation', [{'description': 'Find out more about Swagger', 'title': 'Title', 'url': 'http://swagger.io'}]) + ]) + + self.cmd('az apic api version show -g {rg} -n {s} --api-id swaggerpetstore --version-id 1-0-7', checks=[ + self.check('lifecycleStage', 'design'), + self.check('name', '1-0-7'), + self.check('title', '1-0-7'), + ]) + + self.cmd('az apic api definition show -g {rg} -n {s} --api-id swaggerpetstore --version-id 1-0-7 --definition-id openapi', checks=[ + self.check('description', 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'), + self.check('name', 'openapi'), + self.check('specification.name', 'openapi'), + self.check('specification.version', '2-0'), + self.check('title', 'openapi'), + ]) + @ResourceGroupPreparer(name_prefix="clirg", location=TEST_REGION, random_name_length=32) @ApicServicePreparer() def test_register_with_long_openapi_description(self):